]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
validate: add checks for interfaces
authorSébastien Han <seb@redhat.com>
Mon, 23 Jul 2018 14:02:43 +0000 (16:02 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 24 Jul 2018 15:59:30 +0000 (17:59 +0200)
Check if the interface provided:

* exists in the gathered facts (thus on the system)
* is active
* has an IP address (depending on ip_version )

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1600227
Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-validate/tasks/check_eth_mon.yml [new file with mode: 0644]
roles/ceph-validate/tasks/check_eth_rgw.yml [new file with mode: 0644]
roles/ceph-validate/tasks/main.yml

diff --git a/roles/ceph-validate/tasks/check_eth_mon.yml b/roles/ceph-validate/tasks/check_eth_mon.yml
new file mode 100644 (file)
index 0000000..cb800c2
--- /dev/null
@@ -0,0 +1,26 @@
+---
+- name: "fail if {{ monitor_interface }} does not exist on {{ inventory_hostname }}"
+  fail:
+    msg: "{{ monitor_interface }} does not exist on {{ inventory_hostname }}"
+  when:
+    - monitor_interface not in ansible_interfaces
+
+- name: "fail if {{ monitor_interface }} is not active on {{ inventory_hostname }}"
+  fail:
+    msg: "{{ monitor_interface }} is not active on {{ inventory_hostname }}"
+  when:
+    - not hostvars[inventory_hostname]['ansible_' + monitor_interface]['active']
+
+- name: "fail if {{ monitor_interface }} does not have any ip v4 address on {{ inventory_hostname }}"
+  fail:
+    msg: "{{ monitor_interface }} does not have any IPv4 address on {{ inventory_hostname }}"
+  when:
+    - ip_version == "ipv4"
+    - hostvars[inventory_hostname]['ansible_' + monitor_interface]['ipv4'] is not defined
+
+- name: "fail if {{ monitor_interface }} does not have any ip v6 address on {{ inventory_hostname }}"
+  fail:
+    msg: "{{ monitor_interface }} does not have any IPv6 address on {{ inventory_hostname }}"
+  when:
+    - ip_version == "ipv6"
+    - hostvars[inventory_hostname]['ansible_' + monitor_interface]['ipv6'] is not defined
\ No newline at end of file
diff --git a/roles/ceph-validate/tasks/check_eth_rgw.yml b/roles/ceph-validate/tasks/check_eth_rgw.yml
new file mode 100644 (file)
index 0000000..987eb8e
--- /dev/null
@@ -0,0 +1,26 @@
+---
+- name: "fail if {{ radosgw_interface }} does not exist on {{ inventory_hostname }}"
+  fail:
+    msg: "{{ radosgw_interface }} does not exist on {{ inventory_hostname }}"
+  when:
+    - radosgw_interface not in ansible_interfaces
+
+- name: "fail if {{ radosgw_interface }} is not active on {{ inventory_hostname }}"
+  fail:
+    msg: "{{ radosgw_interface }} is not active on {{ inventory_hostname }}"
+  when:
+    - hostvars[inventory_hostname]['ansible_' + radosgw_interface]['active'] == "false"
+
+- name: "fail if {{ radosgw_interface }} does not have any ip v4 address on {{ inventory_hostname }}"
+  fail:
+    msg: "{{ radosgw_interface }} does not have any IPv4 address on {{ inventory_hostname }}"
+  when:
+    - ip_version == "ipv4"
+    - hostvars[inventory_hostname]['ansible_' + radosgw_interface]['ipv4'] is not defined
+
+- name: "fail if {{ radosgw_interface }} does not have any ip v6 address on {{ inventory_hostname }}"
+  fail:
+    msg: "{{ radosgw_interface }} does not have any IPv6 address on {{ inventory_hostname }}"
+  when:
+    - ip_version == "ipv6"
+    - hostvars[inventory_hostname]['ansible_' + radosgw_interface]['ipv6'] is not defined
\ No newline at end of file
index f733f4edc04cf3168ee2b8d99650dfd279038c4c..c4b77e74a85b52a8f4d6b9bd5522218e2e89e324 100644 (file)
   when:
     - osd_group_name in group_names
     - not osd_auto_discovery | default(False)
-    - osd_scenario != "lvm"
\ No newline at end of file
+    - osd_scenario != "lvm"
+
+- name: include check_eth_mon.yml
+  include: check_eth_mon.yml
+  when:
+    - mon_group_name in group_names
+    - monitor_interface != "dummy"
+    - monitor_address == "0.0.0.0"
+    - monitor_address_block == "subnet"
+
+- name: include check_eth_rgw.yml
+  include: check_eth_rgw.yml
+  when:
+    - rgw_group_name in group_names
+    - radosgw_interface != "dummy"
+    - radosgw_address == "0.0.0.0"
+    - radosgw_address_block == "subnet"
\ No newline at end of file