No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

postgres.yml 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ---
  2. # Defines tasks applicable for postgreSQL
  3. - name: Install Postgres
  4. apt:
  5. name: "{{ packages }}"
  6. state: present
  7. vars:
  8. packages:
  9. - postgresql-9.6
  10. - python-psycopg2
  11. tags:
  12. - dependencies
  13. when: ansible_distribution_version == '9'
  14. - name: Install Postgres
  15. apt:
  16. name: "{{ packages }}"
  17. state: present
  18. vars:
  19. packages:
  20. - postgresql
  21. - python-psycopg2
  22. tags:
  23. - dependencies
  24. when: ansible_distribution_version == '10'
  25. - name: Install Postgres
  26. apt:
  27. name: "{{ packages }}"
  28. state: present
  29. vars:
  30. packages:
  31. - postgresql
  32. - python3-psycopg2
  33. tags:
  34. - dependencies
  35. when: ansible_distribution_version == '11'
  36. - name: Copy PostgreSQL configuration into place
  37. copy: src=etc_postgresql_11_main_postgresql.conf dest=/etc/postgresql/11/main/postgresql.conf owner=postgres group=postgres mode=0644
  38. when: ansible_distribution_version == '10'
  39. - name: Copy PostgreSQL configuration into place
  40. copy: src=etc_postgresql_13_main_postgresql.conf dest=/etc/postgresql/13/main/postgresql.conf owner=postgres group=postgres mode=0644
  41. when: ansible_distribution_version == '11'
  42. - name: Ensure PostgreSQL is restarted
  43. service: name=postgresql state=restarted
  44. - name: Set password for PostgreSQL admin user
  45. become: true
  46. become_user: postgres
  47. postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes