-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathuclalib_postgres.yml
108 lines (100 loc) · 4.4 KB
/
uclalib_postgres.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
- name: uclalib_postgres.yml
become: yes
become_method: sudo
hosts: all
vars_files:
- [ "vars/travis-builds/{{ travischeck }}", "vars/dspace_vars_private.yml" ]
vars:
iptables_alt_allowed_input_rules:
- src_ip: 164.67.153.0/24
protocol: tcp
dest_port: 5432
postgresql_version: 9.5
postgresql_encoding: 'UTF-8'
postgresql_locale: 'en_US.UTF-8'
postgresql_ctype: 'en_US.UTF-8'
postgresql_admin_user: "postgres"
postgresql_default_auth_method: "md5"
postgresql_service_enabled: true
postgresql_pg_hba_default:
- { type: local, database: all, user: '{{ postgresql_admin_user }}', address: '', method: trust, comment: 'PostgreSQL admin user' }
- { type: local, database: all, user: all, address: '', method: md5, comment: 'Unix socket connections' }
- { type: host, database: all, user: all, address: '127.0.0.1/32', method: md5, comment: 'IPv4 local connections' }
postgresql_pg_hba_passwd_hosts:
- t-w-dspace01.library.ucla.edu
- p-w-dspace01.library.ucla.edu
postgresql_listen_addresses:
- "*"
# create a postgresql user for dspace
postgresql_users:
- name: "{{ postgres_build['test']['dataden']['user']['username'] }}"
pass: "{{ postgres_build['test']['dataden']['user']['password'] }}"
encrypted: yes
- name: "{{ postgres_build['test']['vsim']['user']['username'] }}"
pass: "{{ postgres_build['test']['vsim']['user']['password'] }}"
encrypted: yes
- name: "{{ postgres_build['prod']['dataden']['user']['username'] }}"
pass: "{{ postgres_build['prod']['dataden']['user']['password'] }}"
encrypted: yes
- name: "{{ postgres_build['prod']['vsim']['user']['username'] }}"
pass: "{{ postgres_build['prod']['vsim']['user']['password'] }}"
encrypted: yes
# create a database for dspace
postgresql_databases:
- name: "{{ postgres_build['test']['dataden']['dbname'] }}"
owner: "{{ postgres_build['test']['dataden']['user']['username'] }}"
encoding: 'UTF-8'
lc_collate: 'en_US.UTF-8'
lc_ctype: 'en_US.UTF-8'
- name: "{{ postgres_build['test']['vsim']['dbname'] }}"
owner: "{{ postgres_build['test']['vsim']['user']['username'] }}"
encoding: 'UTF-8'
lc_collate: 'en_US.UTF-8'
lc_ctype: 'en_US.UTF-8'
- name: "{{ postgres_build['prod']['dataden']['dbname'] }}"
owner: "{{ postgres_build['prod']['dataden']['user']['username'] }}"
encoding: 'UTF-8'
lc_collate: 'en_US.UTF-8'
lc_ctype: 'en_US.UTF-8'
- name: "{{ postgres_build['prod']['vsim']['dbname'] }}"
owner: "{{ postgres_build['prod']['vsim']['user']['username'] }}"
encoding: 'UTF-8'
lc_collate: 'en_US.UTF-8'
lc_ctype: 'en_US.UTF-8'
# OPTIONAL: you can specify database extensions here (like pgcrypto, which is required for DSapce 6)
postgresql_database_extensions:
- db: "{{ postgres_build['test']['dataden']['dbname'] }}"
extensions:
- pgcrypto
- db: "{{ postgres_build['test']['vsim']['dbname'] }}"
extensions:
- pgcrypto
- db: "{{ postgres_build['prod']['dataden']['dbname'] }}"
extensions:
- pgcrypto
- db: "{{ postgres_build['prod']['vsim']['dbname'] }}"
extensions:
- pgcrypto
# database privileges for the dspace user
postgresql_user_privileges:
- name: "{{ postgres_build['test']['dataden']['user']['username'] }}"
db: "{{ postgres_build['test']['dataden']['dbname'] }}"
priv: "ALL"
role_attr_flags: "CREATEDB"
- name: "{{ postgres_build['test']['vsim']['user']['username'] }}"
db: "{{ postgres_build['test']['vsim']['dbname'] }}"
priv: "ALL"
role_attr_flags: "CREATEDB"
- name: "{{ postgres_build['prod']['dataden']['user']['username'] }}"
db: "{{ postgres_build['prod']['dataden']['dbname'] }}"
priv: "ALL"
role_attr_flags: "CREATEDB"
- name: "{{ postgres_build['prod']['vsim']['user']['username'] }}"
db: "{{ postgres_build['prod']['vsim']['dbname'] }}"
priv: "ALL"
role_attr_flags: "CREATEDB"
# drop a pgpass file in our own user folder, to make working with PostgreSQL via the command line slightly easier
# template: src=templates/dspace_pgpass.j2 dest="~/.pgpass" mode=0600
roles:
- { role: uclalib_role_postgres }