12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- ---
- # Defines tasks applicable for postgreSQL
-
- - name: Install Postgres
- apt:
- name: "{{ packages }}"
- state: present
- vars:
- packages:
- - postgresql-9.6
- - python-psycopg2
- tags:
- - dependencies
- when: ansible_distribution_version == '9'
-
- - name: Install Postgres
- apt:
- name: "{{ packages }}"
- state: present
- vars:
- packages:
- - postgresql
- - python-psycopg2
- - python3-psycopg2
- tags:
- - dependencies
- when: ansible_distribution_version == '10'
-
- - name: Install Postgres
- apt:
- name: "{{ packages }}"
- state: present
- vars:
- packages:
- - postgresql
- - python3-psycopg2
- tags:
- - dependencies
- when: ansible_distribution_version == '11'
-
- - name: Copy PostgreSQL configuration into place
- copy: src=etc_postgresql_11_main_postgresql.conf dest=/etc/postgresql/11/main/postgresql.conf owner=postgres group=postgres mode=0644
- when: ansible_distribution_version == '10'
-
- - name: Copy PostgreSQL configuration into place
- copy: src=etc_postgresql_13_main_postgresql.conf dest=/etc/postgresql/13/main/postgresql.conf owner=postgres group=postgres mode=0644
- when: ansible_distribution_version == '11'
-
- - name: Ensure PostgreSQL is restarted
- service: name=postgresql state=restarted
-
- - name: Set password for PostgreSQL admin user
- become: true
- become_user: postgres
- postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes
|