-
Notifications
You must be signed in to change notification settings - Fork 2
/
privs.yml
83 lines (72 loc) · 2.03 KB
/
privs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
- hosts: all
vars:
oracle_home: /home/ansible/instantclient_12_2
user: USERNAME
password: change12
prt: "1521"
hostname: "SERVER NAME"
sname: DBName
oracle_env:
ORACLE_HOME: "{{oracle_home}}"
LD_LIBRARY_PATH: "{{oracle_home}}"
PATH: "{{oracle_home}}"
vars_files:
- /home/ansible/protect/vault-pass.yml
- /home/ansible/protect/RevokePrivs.yml
tasks:
debug:
msg: " {{item}}"
with_items:
- "{{sql1}}"
register: sqlqry
- name : Display the content
debug:
msg: "{{sqlqry.results}}"
- name: "loop through list from a privilges"
debug:
msg: " {{item}}"
with_items:
- "{{privs}}"
register: privu
- name : Display the content
debug:
msg: "{{privu.results.item.msg}}"
- name: Script will revoke grants from certain user for complaince in AWS RDS
oracle_sql:
username: "{{user}}"
password: "{{password}}"
service_name: "{{sname}}"
port: "{{prt}}"
hostname: "{{hostname}}"
sql: "{{sqlqry}}"
environment: "{{oracle_env}}"
register: query_result
connection: local
- local_action:
copy content={{sql1}}
dest=/home/ansible/protegrityt/log/user_privs.log
- name : Display the content
debug:
msg: "{{ query_result }}"
- name: This playbook will grant or revoke privilges in the user.
oracle_privs:
user: "{{user}}"
password: "{{password}}"
service_name: "{{sname}}"
port: "{{prt}}"
hostname: "{{hostname}}"
privs: "{{privu}}"
state: absent
roles: "{{item}}"
quiet: false
environment: "{{oracle_env}}"
register: user_privs
with_items : "{{query_result.msg}}"
delegate_to: localhost
- name: Display the query results
debug:
msg: "{{ user_privs }}"
with_items: msg.stdout
# - local_action:
# copy content={{sql1}}
# dest=/home/ansible/{{sname}}/log/user_privs.log