]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Clean up checks and with_item loops that are no longer needed due to
authorMatthew Rees <matthew.rees@secate.com>
Tue, 7 Jun 2016 14:27:07 +0000 (16:27 +0200)
committerMatthew Rees <matthew.rees@secate.com>
Tue, 7 Jun 2016 14:27:07 +0000 (16:27 +0200)
other fixes in this PR

roles/ceph-common/tasks/checks/check_firewall.yml

index 5366380e3edb36740a47ac6851c2b1ce726c5f4e..2563506bff8b11786150a71b137bb2f2a5184b68 100644 (file)
   failed_when: false
   register: nmapexist
   run_once: true
-  when: check_firewall
 
 - name: inform that nmap is not present
   debug:
       msg: "nmap is not installed, can not test if ceph ports are allowed :("
   run_once: true
   when:
-    - check_firewall
     - nmapexist.rc != 0
 
 - name: check if monitor port is not filtered
-  local_action: shell set -o pipefail && nmap -p 6789 {{ hostvars[item]['ansible_' + monitor_interface]['ipv4']['address'] if hostvars[item]['ansible_' + monitor_interface] is defined else hostvars[item]['monitor_address'] }} | grep -sqo -e filtered -e '0 hosts up'
+  local_action: shell set -o pipefail && nmap -p 6689 {{ hostvars[inventory_hostname]['ansible_' + monitor_interface]['ipv4']['address'] if hostvars[inventory_hostname]['ansible_' + monitor_interface] is defined else hostvars[inventory_hostname]['monitor_address'] }} | grep -sqo -e filtered -e '0 hosts up'
   changed_when: false
   failed_when: false
-  with_items: "{{ groups[mon_group_name] }}"
   register: monportstate
-  run_once: true
   when:
-    - check_firewall
     - mon_group_name in group_names
     - nmapexist.rc == 0
 
 - name: fail if monitor port is filtered
   fail:
       msg: "Please allow port 6789 on your firewall"
-  with_items: monportstate.results
-  run_once: true
   when:
-    - check_firewall
-    - item is defined and item.has_key('rc') and item.rc == 0
-    - mon_group_name is defined
     - mon_group_name in group_names
+    - monportstate.rc == 0
     - nmapexist.rc == 0
 
 - name: check if osd and mds range is not filtered (osd hosts)
-  local_action: shell set -o pipefail && nmap -p 6800-7300 {{ hostvars[item]['ansible_default_ipv4']['address'] }} | grep -sqo -e filtered -e '0 hosts up'
+  local_action: shell set -o pipefail && nmap -p 6800-7300 {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} | grep -sqo -e filtered -e '0 hosts up'
   changed_when: false
   failed_when: false
-  with_items: "{{ groups[osd_group_name] }}"
   register: osdrangestate
-  run_once: true
   when:
-    - check_firewall
     - osd_group_name in group_names
     - nmapexist.rc == 0
 
 - name: fail if osd and mds range is filtered (osd hosts)
   fail:
       msg: "Please allow range from 6800 to 7300 on your firewall"
-  with_items: osdrangestate.results
-  run_once: true
   when:
-    - check_firewall
-    - item is defined and item.has_key('rc') and item.rc == 0
-    - osd_group_name is defined
     - osd_group_name in group_names
+    - osdrangestate.rc == 0
     - nmapexist.rc == 0
 
 - name: check if osd and mds range is not filtered (mds hosts)
-  local_action: shell set -o pipefail && nmap -p 6800-7300 {{ hostvars[item]['ansible_default_ipv4']['address'] }} | grep -sqo -e filtered -e '0 hosts up'
+  local_action: shell set -o pipefail && nmap -p 6800-7300 {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} | grep -sqo -e filtered -e '0 hosts up'
   changed_when: false
   failed_when: false
-  with_items: "{{ groups[mds_group_name] }}"
   register: mdsrangestate
-  run_once: true
   when:
-    - check_firewall
     - mds_group_name in group_names
     - nmapexist.rc == 0
 
 - name: fail if osd and mds range is filtered (mds hosts)
   fail:
       msg: "Please allow range from 6800 to 7300 on your firewall"
-  with_items: mdsrangestate.results
-  run_once: true
   when:
-    - check_firewall
-    - item is defined and item.has_key('rc') and item.rc == 0
-    - mds_group_name is defined
     - mds_group_name in group_names
+    - mdsrangestate.rc == 0
     - nmapexist.rc == 0
 
 - name: check if rados gateway port is not filtered
-  local_action: shell set -o pipefail && nmap -p {{ radosgw_civetweb_port }} {{ hostvars[item]['ansible_default_ipv4']['address'] }} | grep -sqo -e filtered -e '0 hosts up'
+  local_action: shell set -o pipefail && nmap -p {{ radosgw_civetweb_port }} {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }} | grep -sqo -e filtered -e '0 hosts up'
   changed_when: false
   failed_when: false
-  with_items: "{{ groups[rgw_group_name] }}"
   register: rgwportstate
-  run_once: true
   when:
-    - check_firewall
     - rgw_group_name in group_names
     - nmapexist.rc == 0
 
 - name: fail if rados gateway port is filtered
   fail:
       msg: "Please allow port {{ radosgw_civetweb_port }} on your firewall"
-  with_items: rgwportstate.results
-  run_once: true
   when:
-    - check_firewall
-    - item is defined and item.has_key('rc') and item.rc == 0
-    - rgw_group_name is defined
     - rgw_group_name in group_names
+    - rgwportstate.rc == 0
     - nmapexist.rc == 0