diff --git a/infrastructure-playbooks/docker-to-podman.yml b/infrastructure-playbooks/docker-to-podman.yml index fa0502b4c..458cee99a 100644 --- a/infrastructure-playbooks/docker-to-podman.yml +++ b/infrastructure-playbooks/docker-to-podman.yml @@ -46,6 +46,7 @@ - "{{ mgr_group_name | default('mgrs') }}" - "{{ iscsi_gw_group_name | default('iscsigws') }}" - "{{ rbdmirror_group_name | default('rbdmirrors') }}" + - "{{ grafana_server_group_name|default('grafana-server') }}" gather_facts: false become: true tasks: @@ -86,6 +87,30 @@ inventory_hostname in groups.get(iscsi_gw_group_name, []) or inventory_hostname in groups.get(nfs_group_name, []) + - name: "pulling alertmanager/grafana/prometheus images from docker daemon" + command: "{{ timeout_command }} {{ container_binary }} pull docker-daemon:{{ item }}" + changed_when: false + register: pull_image + until: pull_image.rc == 0 + retries: "{{ docker_pull_retry }}" + delay: 10 + loop: + - "{{ alertmanager_container_image }}" + - "{{ grafana_container_image }}" + - "{{ prometheus_container_image }}" + when: + - dashboard_enabled | bool + - inventory_hostname in groups.get(grafana_server_group_name, []) + + - name: "pulling {{ node_exporter_container_image }} image from docker daemon" + command: "{{ timeout_command }} {{ container_binary }} pull docker-daemon:{{ node_exporter_container_image }}" + changed_when: false + register: pull_image + until: pull_image.rc == 0 + retries: "{{ docker_pull_retry }}" + delay: 10 + when: dashboard_enabled | bool + - import_role: name: ceph-mon tasks_from: systemd.yml @@ -131,6 +156,28 @@ tasks_from: systemd.yml when: inventory_hostname in groups.get(rgw_group_name, []) + - name: dashboard configuration + when: dashboard_enabled | bool + block: + - import_role: + name: ceph-node-exporter + tasks_from: systemd.yml + + - import_role: + name: ceph-facts + tasks_from: grafana.yml + when: inventory_hostname in groups.get(grafana_server_group_name, []) + + - import_role: + name: ceph-grafana + tasks_from: systemd.yml + when: inventory_hostname in groups.get(grafana_server_group_name, []) + + - import_role: + name: ceph-prometheus + tasks_from: systemd.yml + when: inventory_hostname in groups.get(grafana_server_group_name, []) + - name: reload systemd daemon systemd: daemon_reload: yes \ No newline at end of file diff --git a/roles/ceph-grafana/tasks/setup_container.yml b/roles/ceph-grafana/tasks/setup_container.yml index de5f24ae2..666eff780 100644 --- a/roles/ceph-grafana/tasks/setup_container.yml +++ b/roles/ceph-grafana/tasks/setup_container.yml @@ -10,13 +10,8 @@ - /etc/grafana - /var/lib/grafana -- name: ship systemd service - template: - src: grafana-server.service.j2 - dest: "/etc/systemd/system/grafana-server.service" - owner: root - group: root - mode: 0644 +- name: include_tasks systemd.yml + include_tasks: systemd.yml - name: start the grafana-server service systemd: diff --git a/roles/ceph-grafana/tasks/systemd.yml b/roles/ceph-grafana/tasks/systemd.yml new file mode 100644 index 000000000..d51387058 --- /dev/null +++ b/roles/ceph-grafana/tasks/systemd.yml @@ -0,0 +1,8 @@ +--- +- name: ship systemd service + template: + src: grafana-server.service.j2 + dest: "/etc/systemd/system/grafana-server.service" + owner: root + group: root + mode: 0644 diff --git a/roles/ceph-node-exporter/tasks/setup_container.yml b/roles/ceph-node-exporter/tasks/setup_container.yml index 325682cc7..a15c02160 100644 --- a/roles/ceph-node-exporter/tasks/setup_container.yml +++ b/roles/ceph-node-exporter/tasks/setup_container.yml @@ -1,11 +1,6 @@ --- -- name: ship systemd service - template: - src: node_exporter.service.j2 - dest: "/etc/systemd/system/node_exporter.service" - owner: root - group: root - mode: 0644 +- name: include_tasks systemd.yml + include_tasks: systemd.yml - name: start the node_exporter service systemd: diff --git a/roles/ceph-node-exporter/tasks/systemd.yml b/roles/ceph-node-exporter/tasks/systemd.yml new file mode 100644 index 000000000..4df992080 --- /dev/null +++ b/roles/ceph-node-exporter/tasks/systemd.yml @@ -0,0 +1,8 @@ +--- +- name: ship systemd service + template: + src: node_exporter.service.j2 + dest: "/etc/systemd/system/node_exporter.service" + owner: root + group: root + mode: 0644 diff --git a/roles/ceph-prometheus/handlers/main.yml b/roles/ceph-prometheus/handlers/main.yml index 1e84e565a..dca87676a 100644 --- a/roles/ceph-prometheus/handlers/main.yml +++ b/roles/ceph-prometheus/handlers/main.yml @@ -10,3 +10,4 @@ with_items: - 'alertmanager' - 'prometheus' + when: not docker2podman | default(False) | bool diff --git a/roles/ceph-prometheus/tasks/setup_container.yml b/roles/ceph-prometheus/tasks/setup_container.yml index b07354718..25eec6e96 100644 --- a/roles/ceph-prometheus/tasks/setup_container.yml +++ b/roles/ceph-prometheus/tasks/setup_container.yml @@ -1,15 +1,6 @@ --- -- name: ship systemd services - template: - src: "{{ item }}.j2" - dest: "/etc/systemd/system/{{ item }}" - owner: root - group: root - mode: 0644 - with_items: - - 'alertmanager.service' - - 'prometheus.service' - notify: service handler +- name: include_tasks systemd.yml + include_tasks: systemd.yml - name: start prometheus services systemd: diff --git a/roles/ceph-prometheus/tasks/systemd.yml b/roles/ceph-prometheus/tasks/systemd.yml new file mode 100644 index 000000000..eb587ac62 --- /dev/null +++ b/roles/ceph-prometheus/tasks/systemd.yml @@ -0,0 +1,12 @@ +--- +- name: ship systemd services + template: + src: "{{ item }}.j2" + dest: "/etc/systemd/system/{{ item }}" + owner: root + group: root + mode: 0644 + with_items: + - 'alertmanager.service' + - 'prometheus.service' + notify: service handler diff --git a/tests/functional/docker2podman/group_vars/all b/tests/functional/docker2podman/group_vars/all index 2f7e7b499..ceec85e56 100644 --- a/tests/functional/docker2podman/group_vars/all +++ b/tests/functional/docker2podman/group_vars/all @@ -42,4 +42,5 @@ openstack_pools: - "{{ openstack_cinder_pool }}" handler_health_mon_check_delay: 10 handler_health_osd_check_delay: 10 -dashboard_enabled: false \ No newline at end of file +dashboard_admin_password: $sX!cD$rYU6qR^B! +grafana_admin_password: +xFRe+RES@7vg24n \ No newline at end of file diff --git a/tests/functional/docker2podman/hosts b/tests/functional/docker2podman/hosts index b29e9111c..2a6862160 100644 --- a/tests/functional/docker2podman/hosts +++ b/tests/functional/docker2podman/hosts @@ -7,5 +7,5 @@ osd0 [mgrs] mon0 -#[all:vars] -#ansible_python_interpreter=/usr/bin/python3 \ No newline at end of file +[grafana-server] +mon0 \ No newline at end of file