Skip to content
Snippets Groups Projects
Commit a5d05580 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

postgresql ansible wip

(with help from @bbrancot)

Former-commit-id: 17ca1fd4ddd424433338097b58951fd52887d0b7
parent 5eca3b34
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
- name: Ensure PostgreSQL is listening on all localhost - name: Ensure PostgreSQL is listening on all localhost
lineinfile: dest=/var/lib/pgsql/data/postgresql.conf lineinfile: dest=/var/lib/pgsql/data/postgresql.conf
regexp='^#?listen_addresses\s*=' regexp='^#?listen_addresses\s*='
line="listen_addresses = '127.0.0.1'" line="listen_addresses = '*'"
state=present state=present
- lineinfile: dest=/var/lib/pgsql/data/pg_hba.conf - lineinfile: dest=/var/lib/pgsql/data/pg_hba.conf
regexp='host\s+all\s+all\s+127.0.0.1/32\s+md5' regexp='host\s+all\s+all\s+127.0.0.1/32\s+md5'
...@@ -79,14 +79,10 @@ ...@@ -79,14 +79,10 @@
insertbefore=BOF insertbefore=BOF
- name: restart postgresql service - name: restart postgresql service
systemd: state=restarted name=postgresql enabled=yes systemd: state=restarted name=postgresql enabled=yes
- name: ensure database is created - postgresql_user:
postgresql_db: name={{dbname}} name: {{dbuser}}
- name: ensure user has access to database password: {{dbpassword}}
postgresql_user: db={{dbname}} name={{dbuser}} password={{dbpassword}} priv=ALL role_attr_flags: CREATEDB,NOSUPERUSER
- name: ensure user does not have unnecessary privilege
postgresql_user: name={{dbuser}} role_attr_flags=NOSUPERUSER,NOCREATEDB
- name: ensure no other user can access the database
postgresql_privs: db={{dbname}} role=PUBLIC type=database priv=ALL state=absent
# #
# Stop web server(s) # Stop web server(s)
# #
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment