Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

74 строки
2.9 KiB

  1. ---
  2. - name: Ensure matrix-grafana image is pulled
  3. community.docker.docker_image:
  4. name: "{{ matrix_grafana_docker_image }}"
  5. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  6. force_source: "{{ matrix_grafana_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  7. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_grafana_docker_image_force_pull }}"
  8. register: result
  9. retries: "{{ devture_playbook_help_container_retries_count }}"
  10. delay: "{{ devture_playbook_help_container_retries_delay }}"
  11. until: result is not failed
  12. - name: Ensure grafana paths exists
  13. ansible.builtin.file:
  14. path: "{{ item }}"
  15. state: directory
  16. mode: 0750
  17. owner: "{{ matrix_user_username }}"
  18. group: "{{ matrix_user_groupname }}"
  19. with_items:
  20. - "{{ matrix_grafana_base_path }}"
  21. - "{{ matrix_grafana_config_path }}"
  22. - "{{ matrix_grafana_config_path }}/provisioning"
  23. - "{{ matrix_grafana_config_path }}/provisioning/datasources"
  24. - "{{ matrix_grafana_config_path }}/provisioning/dashboards"
  25. - "{{ matrix_grafana_config_path }}/dashboards"
  26. - "{{ matrix_grafana_data_path }}"
  27. - name: Ensure grafana.ini present
  28. ansible.builtin.template:
  29. src: "{{ role_path }}/templates/grafana.ini.j2"
  30. dest: "{{ matrix_grafana_config_path }}/grafana.ini"
  31. mode: 0440
  32. owner: "{{ matrix_user_username }}"
  33. group: "{{ matrix_user_groupname }}"
  34. - name: Ensure provisioning/datasources/default.yaml present
  35. ansible.builtin.template:
  36. src: "{{ role_path }}/templates/datasources.yaml.j2"
  37. dest: "{{ matrix_grafana_config_path }}/provisioning/datasources/default.yaml"
  38. mode: 0440
  39. owner: "{{ matrix_user_username }}"
  40. group: "{{ matrix_user_groupname }}"
  41. - name: Ensure provisioning/dashboards/default.yaml present
  42. ansible.builtin.template:
  43. src: "{{ role_path }}/templates/dashboards.yaml.j2"
  44. dest: "{{ matrix_grafana_config_path }}/provisioning/dashboards/default.yaml"
  45. mode: 0440
  46. owner: "{{ matrix_user_username }}"
  47. group: "{{ matrix_user_groupname }}"
  48. - name: Ensure dashboard(s) downloaded
  49. ansible.builtin.get_url:
  50. url: "{{ item }}"
  51. dest: "{{ matrix_grafana_config_path }}/dashboards/"
  52. force: true
  53. mode: 0440
  54. owner: "{{ matrix_user_username }}"
  55. group: "{{ matrix_user_groupname }}"
  56. with_items: "{{ matrix_grafana_dashboard_download_urls }}"
  57. register: result
  58. retries: "{{ devture_playbook_help_geturl_retries_count }}"
  59. delay: "{{ devture_playbook_help_geturl_retries_delay }}"
  60. until: result is not failed
  61. - name: Ensure matrix-grafana.service installed
  62. ansible.builtin.template:
  63. src: "{{ role_path }}/templates/systemd/matrix-grafana.service.j2"
  64. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-grafana.service"
  65. mode: 0644
  66. register: matrix_grafana_systemd_service_result