--- - name: 'prometheus | server | assert | check mandatory vars are defined' assert: that: - "prometheus_server_monitor is defined" tags: ['prometheus_server'] - name: 'prometheus | server | create docker network' docker_network: name: '{{ prometheus_docker_network }}' tags: ['prometheus_server'] - name: 'prometheus | server | create docker volume data' docker_volume: name: prometheus_data register: register_docker_volume_prometheus__prometheus_data tags: ['prometheus_server'] - name: 'prometheus | server | create prometheus directory to /etc' file: path: /etc/prometheus state: directory mode: '0755' tags: ['prometheus_server'] - name: 'prometheus | server | copy config prometheus yml' template: src: conf/prometheus.yml.j2 dest: /etc/prometheus/prometheus.yml owner: root group: root mode: 0644 tags: ['prometheus_server'] notify: - 'grafana-prometheus | server | restart container' - name: "grafana-prometheus | create docker-compose directory" file: path: /opt/docker-compose/grafana-prometheus state: directory mode: '0755' tags: [ 'grafana-prometheus', 'prometheus_server' ] - name: "grafana-prometheus | copy docker-compose file" template: src: compose/grafana-prometheus.yml.j2 dest: /opt/docker-compose/grafana-prometheus/docker-compose.yml owner: root group: root mode: 0644 notify: "grafana-prometheus | server | restart container" tags: [ 'grafana-prometheus' ] - name: "grafana-prometheus | create grafana.ini file" file: path: /opt/docker-compose/grafana-prometheus/grafana.ini owner: '1000' group: '1000' mode: '0750' state: touch notify: "grafana-prometheus | server | restart container" tags: [ 'grafana-prometheus' ] ignore_errors: '{{ ansible_check_mode }}' - name: "grafana-prometheus | import grafana provisioned datasources" synchronize: src: "{{ grafana_provisioned_datasources_path }}" dest: /opt/docker-compose/grafana-prometheus/ when: grafana_provisioned_datasources_path is defined notify: "grafana-prometheus | server | restart container" tags: [ 'grafana-prometheus' ] - name: "grafana-prometheus | import grafana provisioned dashboards" synchronize: src: "{{ grafana_provisioned_dashboards_path }}" dest: /opt/docker-compose/grafana-prometheus/ when: grafana_provisioned_datasources_path is defined notify: "grafana-prometheus | server | restart container" tags: [ 'grafana-prometheus' ] - name: "grafana-prometheus | install unit file to systemd" vars: exporter: "grafana-prometheus" template: src: systemd/docker-compose.service.j2 dest: /etc/systemd/system/docker-compose@grafana-prometheus.service owner: root group: root mode: 0600 tags: [ 'grafana-prometheus' ] - name: "grafana-prometheus | enable service" systemd: daemon_reload: yes name: docker-compose@grafana-prometheus enabled: true ignore_errors: '{{ ansible_check_mode }}' tags: [ 'grafana-prometheus' ]