-
Notifications
You must be signed in to change notification settings - Fork 204
Expand file tree
/
Copy pathmain.yml
More file actions
85 lines (73 loc) · 1.89 KB
/
Copy pathmain.yml
File metadata and controls
85 lines (73 loc) · 1.89 KB
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
---
- name: "Load OS variables"
include_vars: "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- name: 'Install PostgreSQL packages'
package:
name: "{{ external_database_packages }}"
state: installed
- name: 'Init PostgreSQL database'
command: postgresql-setup initdb
args:
creates: "{{ external_database_postgresql_conf_path }}"
- name: 'Deploy pg_hba.conf'
template:
dest: "{{ external_database_pg_hba_conf_path }}"
src: pg_hba.conf.j2
mode: 0600
owner: postgres
group: postgres
- name: Set listen addresses to *
lineinfile:
dest: "{{ external_database_postgresql_conf_path }}"
regexp: "^listen_addresses"
line: "listen_addresses = '*'"
state: present
backup: yes
- name: Set password_encryption
lineinfile:
dest: "{{ external_database_postgresql_conf_path }}"
regexp: "password_encryption ="
line: "password_encryption = {{ external_database_encryption }}"
state: present
backup: yes
- name: 'Ensure PostgreSQL is running'
service:
name: postgresql
state: restarted
enabled: yes
- name: 'Add database user'
become_user: postgres
postgresql_user:
state: present
name: "foreman"
password: "foreman"
- name: 'Create Foreman database'
become_user: postgres
postgresql_db:
state: present
name: "foreman"
owner: "foreman"
- name: 'Add candlepin database user'
become_user: postgres
postgresql_user:
state: present
name: "candlepin"
password: "candlepin"
- name: 'Create Candlepin database'
become_user: postgres
postgresql_db:
state: present
name: "candlepin"
owner: "candlepin"
- name: 'Add pulp database user'
become_user: postgres
postgresql_user:
state: present
name: "pulp"
password: "pulp"
- name: 'Create Pulp database'
become_user: postgres
postgresql_db:
state: present
name: "pulp"
owner: "pulp"