暫無描述
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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. - python3-psycopg2
  23. tags:
  24. - dependencies
  25. when: ansible_distribution_version == '10'
  26. - name: Install Postgres
  27. apt:
  28. name: "{{ packages }}"
  29. state: present
  30. vars:
  31. packages:
  32. - postgresql
  33. - python3-psycopg2
  34. tags:
  35. - dependencies
  36. when: ansible_distribution_version == '11'
  37. - name: Copy PostgreSQL configuration into place
  38. copy: src=etc_postgresql_11_main_postgresql.conf dest=/etc/postgresql/11/main/postgresql.conf owner=postgres group=postgres mode=0644
  39. when: ansible_distribution_version == '10'
  40. - name: Copy PostgreSQL configuration into place
  41. copy: src=etc_postgresql_13_main_postgresql.conf dest=/etc/postgresql/13/main/postgresql.conf owner=postgres group=postgres mode=0644
  42. when: ansible_distribution_version == '11'
  43. - name: Ensure PostgreSQL is restarted
  44. service: name=postgresql state=restarted
  45. - name: Set password for PostgreSQL admin user
  46. become: true
  47. become_user: postgres
  48. postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes