Matrix Docker Ansible eploy
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

52 řádky
2.2 KiB

  1. ---
  2. - ansible.builtin.include_role:
  3. name: galaxy/com.devture.ansible.role.postgres
  4. tasks_from: detect_existing_postgres_version
  5. when: 'matrix_postgres_backup_postgres_data_path != ""'
  6. # If we have found an existing version (installed from before), we use its corresponding Docker image.
  7. # If not, we install using the latest Postgres.
  8. #
  9. # Upgrading is supposed to be performed separately and explicitly (see `upgrade_postgres.yml`).
  10. - ansible.builtin.set_fact:
  11. matrix_postgres_backup_docker_image_to_use: "{{ matrix_postgres_backup_docker_image_latest if matrix_postgres_backup_detected_version_corresponding_docker_image | default('') == '' else matrix_postgres_backup_detected_version_corresponding_docker_image }}"
  12. - name: Ensure postgres backup Docker image is pulled
  13. community.docker.docker_image:
  14. name: "{{ matrix_postgres_backup_docker_image_to_use }}"
  15. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  16. force_source: "{{ matrix_postgres_backup_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  17. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_postgres_backup_docker_image_force_pull }}"
  18. register: result
  19. retries: "{{ devture_playbook_help_container_retries_count }}"
  20. delay: "{{ devture_playbook_help_container_retries_delay }}"
  21. until: result is not failed
  22. - name: Ensure Postgres backup paths exist
  23. ansible.builtin.file:
  24. path: "{{ item }}"
  25. state: directory
  26. mode: 0700
  27. owner: "{{ matrix_user_username }}"
  28. group: "{{ matrix_user_groupname }}"
  29. with_items:
  30. - "{{ matrix_postgres_backup_path }}"
  31. - name: Ensure Postgres environment variables file created
  32. ansible.builtin.template:
  33. src: "{{ role_path }}/templates/{{ item }}.j2"
  34. dest: "{{ matrix_postgres_backup_path }}/{{ item }}"
  35. owner: "{{ matrix_user_username }}"
  36. group: "{{ matrix_user_groupname }}"
  37. mode: 0640
  38. with_items:
  39. - "env-postgres-backup"
  40. - name: Ensure matrix-postgres-backup.service installed
  41. ansible.builtin.template:
  42. src: "{{ role_path }}/templates/systemd/matrix-postgres-backup.service.j2"
  43. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-postgres-backup.service"
  44. mode: 0644