]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
docker2podman: manage dashboard nodes
authorDimitri Savineau <dsavinea@redhat.com>
Thu, 16 Apr 2020 16:17:12 +0000 (12:17 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Wed, 3 Jun 2020 17:20:24 +0000 (13:20 -0400)
The dashboard nodes (alertmanager, grafana, node-exporter, and prometheus)
were not manage during the docker to podman migration.

This adds the systemd container template of those services to a dedicated
file (systemd.yml) in order to include it in the docker2podman playbook.

This also adds the dashboard container images pull from docker to podman.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1829389
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 252e78b4e4e90bc1c21d9dfd4a7c9bd132e94730)

infrastructure-playbooks/docker-to-podman.yml
roles/ceph-grafana/tasks/setup_container.yml
roles/ceph-grafana/tasks/systemd.yml [new file with mode: 0644]
roles/ceph-node-exporter/tasks/setup_container.yml
roles/ceph-node-exporter/tasks/systemd.yml [new file with mode: 0644]
roles/ceph-prometheus/handlers/main.yml
roles/ceph-prometheus/tasks/setup_container.yml
roles/ceph-prometheus/tasks/systemd.yml [new file with mode: 0644]
tests/functional/docker2podman/hosts

index a27b1fd8aeccb8a72f5150a42155c1bac8cfde67..fa83b1ca60fac07d1b261f16fabc9c49ea50084f 100644 (file)
@@ -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:
             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
         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
index a444ca8e20bb943b7122ccf0f69699e2a8e8c898..33e6f61c82aa377b9ec230e159df122d5cdc5918 100644 (file)
     - /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 (file)
index 0000000..d513870
--- /dev/null
@@ -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
index 2dd4dd100a9d000e7ecdd22e4b949773462a45b5..4208fb7d2c4212584f09b66157de36970501c618 100644 (file)
@@ -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 (file)
index 0000000..4df9920
--- /dev/null
@@ -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
index bd4a153f72e125ccfe3c15e4994f22f276a00f16..dca87676aaad4cbd685b4f2925a2b512d1600ecf 100644 (file)
@@ -9,4 +9,5 @@
     state: restarted
   with_items:
     - 'alertmanager'
-    - 'prometheus'
\ No newline at end of file
+    - 'prometheus'
+  when: not docker2podman | default(False) | bool
index b07354718d6d79d843ea06dbe964bd971f479fac..25eec6e96141aaddaeed68fa562a8c03d1927f49 100644 (file)
@@ -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 (file)
index 0000000..eb587ac
--- /dev/null
@@ -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
index 60e953a48cf3f07cab8a9843cfa8bf299c7acb90..294792600eb562eeeebe2cb9422abc9b1be2041f 100644 (file)
@@ -10,5 +10,5 @@ mon0
 [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