Ansiblesation des VMs de BDD #32
1 changed files with 9 additions and 3 deletions
|
@ -1,8 +1,10 @@
|
||||||
---
|
---
|
||||||
- name: Install postgresql
|
- name: Install postgresql and psycopg2
|
||||||
apt:
|
apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
name: postgresql
|
pkg:
|
||||||
|
- postgresql
|
||||||
|
- python3-psycopg2
|
||||||
state: present
|
state: present
|
||||||
register: apt_result
|
register: apt_result
|
||||||
retries: 3
|
retries: 3
|
||||||
|
@ -39,11 +41,15 @@
|
||||||
- restart postgresql
|
- restart postgresql
|
||||||
|
|
||||||
- name: Create databases
|
- name: Create databases
|
||||||
|
become: true
|
||||||
|
become_user: postgres
|
||||||
postgresql_db:
|
postgresql_db:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item }}"
|
||||||
loop: "{{ postgresql_databases }}"
|
loop: "{{ postgresql_databases }}"
|
||||||
|
|
||||||
- name: Create users
|
- name: Create users
|
||||||
|
become: true
|
||||||
|
become_user: postgres
|
||||||
postgresql_user:
|
postgresql_user:
|
||||||
db: "{{ item.database }}"
|
db: "{{ item.database }}"
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
|
|
Loading…
Reference in a new issue