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.

36 lines
980 B

  1. ---
  2. - name: Install PostgreSQL
  3. apt:
  4. name: postgresql-{{ postgresql_version }}
  5. - name: Remove postgresql from init.d (may conflict with systemd service)
  6. file:
  7. path: /etc/init.d/postgresql
  8. state: absent
  9. when: is_docker
  10. - name: Update rc.d to reflect init.d removal
  11. command:
  12. cmd: update-rc.d postgresql remove
  13. when: is_docker
  14. - name: Start and enable PostgreSQL meta unit service
  15. systemd_service:
  16. name: postgresql
  17. state: started
  18. enabled: true
  19. - name: Start and enable PostgreSQL cluster service
  20. systemd_service:
  21. name: postgresql@{{ postgresql_version }}-main
  22. state: started
  23. enabled: true
  24. - name: Set configuration options in postgresql.conf
  25. lineinfile:
  26. path: /etc/postgresql/{{ postgresql_version }}/main/postgresql.conf
  27. regexp: "^#?{{ item.key }} ?="
  28. line: "{{ item.key }} = {{ item.value }}"
  29. loop: "{{ _postgresql_settings | combine(postgresql_settings) | dict2items }}"
  30. notify:
  31. - Restart postgresql