blob: 537a96d147a16fe404efa4fb65f5d94edebc3bee (
plain)
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
|
---
- name: set max_connections for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^max_connections ='
line: 'max_connections = 150'
notify: restart postgresql
- name: set shared_buffers for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^shared_buffers ='
line: 'shared_buffers = 33536MB'
notify: restart postgresql
- name: set effective_cache_size for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^effective_cache_size ='
line: 'effective_cache_size = 100608MB'
notify: restart postgresql
- name: set work_mem for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^work_mem ='
line: 'work_mem = 8MB'
notify: restart postgresql
- name: set maintenance_work_mem for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^maintenance_work_mem ='
line: 'maintenance_work_mem = 2GB'
notify: restart postgresql
- name: set checkpoint_segments for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^checkpoint_segments ='
line: 'checkpoint_segments = 32'
notify: restart postgresql
- name: set checkpoint_completion_target for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^checkpoint_completion_target ='
line: 'checkpoint_completion_target = 0.9'
notify: restart postgresql
- name: set wal_buffers for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^wal_buffers ='
line: 'wal_buffers = -1'
notify: restart postgresql
- name: set default_statistics_target for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^default_statistics_target ='
line: 'default_statistics_target = 100'
notify: restart postgresql
- name: drop faf database
postgresql_db: name=faf
owner=postgres
state=absent
when: faf_recreate_database
- name: check postgresql initdb
stat: path=/var/lib/pgsql/initdb.log
register: st
- name: initdb postgresql
command: postgresql-setup initdb
when: st.stat.exists == False
become: true
- name: start service postgresql
service: name=postgresql
state=started
enabled=yes
become: true
- name: pgsql create db faf
postgresql_db: name=faf
owner=postgres
state=present
become: true
become_user: postgres
- name: pgsql create user faf
postgresql_user: db=faf
name=faf
priv=ALL
role_attr_flags=SUPERUSER
state=present
become: true
become_user: postgres
- name: create extension for faf
postgresql_ext: name=semver
db=faf
state=present
become: true
become_user: postgres
|