use postgres user to create postgres role and db (#28231)

Also install postgresql package.
This commit is contained in:
Emmanuel Cazenave 2018-11-21 18:43:33 +01:00
parent c3fa5e27ea
commit 8b687e7f81
3 changed files with 15 additions and 7 deletions

View File

@ -77,4 +77,6 @@
name: "{{item.value.db_name}}"
state: absent
with_dict: "{{apps}}"
become: yes
become_user: postgres

View File

@ -8,6 +8,8 @@
postgresql_db:
name: "{{db_name}}"
owner: "{{user}}"
become: yes
become_user: postgres
- name: "{{app_name}} - conf directory"
file:

View File

@ -1,33 +1,37 @@
---
- name: Install system packages depedencies
- name: Install system packages dependencies
apt:
name: "{{ item }}"
state: present
with_items:
- gettext
- graphicsmagick
- graphviz
- inkscape
- libjs-leaflet
- libjs-pdf
- libldap2-dev
- libsasl2-dev
- libssl-dev
- make
- nginx
- postgresql
- python-dev
- python-lasso
- python-pip
- python-virtualenv
- python-psycopg2
- gettext
- python-virtualenv
- rabbitmq-server
- ruby-sass
- supervisor
- libjs-leaflet
- libjs-pdf
- graphicsmagick
- graphviz
become: yes
- name: "create the postgresql user named {{user}}"
postgresql_user:
name: "{{user}}"
role_attr_flags: CREATEDB,LOGIN
become: yes
become_user: postgres
- name: create the virtualenv and install django
pip: