-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdbservers.yml
60 lines (46 loc) · 1.32 KB
/
dbservers.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
---
# the database servers
# uncomment this if you install a monitoring server
#- hosts: monitoring
# tasks:
# - name: talk to monitoring servers to populate facts
# command: /bin/true
- hosts: db
vars:
node_type: db
dbname: owncloud
dbuser: owncloud
dbpassword: owncloud
vars_files:
- vars/users.yml
roles:
- common
# - zabbix_agent
- postgres
- hosts: db
sudo: yes
sudo_user: postgres
gather_facts: no
vars:
dbname: owncloud
dbuser: owncloud
dbpassword: owncloud
handlers:
- include: roles/postgres/handlers/main.yml
tasks:
- name: ensure database is created
postgresql_db: name={{dbname}}
- name: ensure user has access to database
postgresql_user: db={{dbname}} name={{dbuser}} password={{dbpassword}} priv=ALL
# uncomment this if you install a monitoring server
# - name: ensure zabbix database is created
# postgresql_db: name=zabbix
# - name: give access to zabbix user
# postgresql_user: db=zabbix name=zabbix password=zabbix priv=ALL
# - name: ensure user has access to database
# postgresql_user: db={{dbname}} name=zabbix password=zabbix priv=ALL
- name: ensure user does not have unnecessary privilege
postgresql_user: name={{item}} role_attr_flags=NOSUPERUSER,NOCREATEDB
with_items:
- owncloud
- zabbix