From 8b5b3cef4e6bfafe9f20302c4da8d0d27efd7669 Mon Sep 17 00:00:00 2001
From: Bertrand Lallau <bertrand.lallau@thalesgroup.com>
Date: Tue, 4 Jul 2017 17:12:10 +0200
Subject: [PATCH] Clean some Boolean condition checks

* "bool" filter is removed when not required
* 'not' is used instead of '== False' check

Change-Id: I85a5bb9a5ea874ac1c397cbf8de416147d2424c3
---
 ansible/roles/baremetal/tasks/install.yml      | 2 +-
 ansible/roles/baremetal/tasks/post-install.yml | 2 +-
 ansible/roles/baremetal/tasks/pre-install.yml  | 2 +-
 ansible/roles/ceph/tasks/bootstrap_osds.yml    | 4 ++--
 ansible/roles/common/tasks/config.yml          | 2 +-
 ansible/roles/keystone/tasks/config.yml        | 2 +-
 ansible/roles/nova/tasks/config.yml            | 2 +-
 ansible/roles/nova/tasks/deploy.yml            | 2 +-
 etc/kolla/globals.yml                          | 2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ansible/roles/baremetal/tasks/install.yml b/ansible/roles/baremetal/tasks/install.yml
index ea3e7d9a9c..cfc756b78c 100644
--- a/ansible/roles/baremetal/tasks/install.yml
+++ b/ansible/roles/baremetal/tasks/install.yml
@@ -60,7 +60,7 @@
   package: name={{item}} state=absent
   with_items: "{{ ubuntu_pkg_removals }}"
   become: True
-  when: ansible_distribution|lower == "ubuntu" | bool
+  when: ansible_distribution|lower == "ubuntu"
 
 - name: Remove packages
   package: name={{item}} state=absent
diff --git a/ansible/roles/baremetal/tasks/post-install.yml b/ansible/roles/baremetal/tasks/post-install.yml
index 75c6de5382..c8a6bc2320 100644
--- a/ansible/roles/baremetal/tasks/post-install.yml
+++ b/ansible/roles/baremetal/tasks/post-install.yml
@@ -27,7 +27,7 @@
   become: True
   when:
     - ansible_distribution == "Ubuntu"
-    - apparmor_libvirtd_profile.stat.exists | bool
+    - apparmor_libvirtd_profile.stat.exists
 
 - name: Create docker group
   group:
diff --git a/ansible/roles/baremetal/tasks/pre-install.yml b/ansible/roles/baremetal/tasks/pre-install.yml
index d8632ae4b5..3818c9b2c2 100644
--- a/ansible/roles/baremetal/tasks/pre-install.yml
+++ b/ansible/roles/baremetal/tasks/pre-install.yml
@@ -141,4 +141,4 @@
     recurse: yes
     mode: 0644
   become: True
-  when: create_kolla_user | bool == False
+  when: not create_kolla_user | bool
diff --git a/ansible/roles/ceph/tasks/bootstrap_osds.yml b/ansible/roles/ceph/tasks/bootstrap_osds.yml
index 78c85e17e9..2bff0cfc69 100644
--- a/ansible/roles/ceph/tasks/bootstrap_osds.yml
+++ b/ansible/roles/ceph/tasks/bootstrap_osds.yml
@@ -34,7 +34,7 @@
               ceph_osd_wipe_disk: 'yes-i-really-really-mean-it' within globals.yml)
   with_items: "{{ osds_bootstrap|default([]) }}"
   when:
-    - item.external_journal | bool == False
+    - not item.external_journal | bool
     - item.device.split('/')[2] in ansible_devices  # if there is no device in setup (like loopback, we don't need to warn user
     - ansible_devices[item.device.split('/')[2]].partitions|count > 1
     - ceph_osd_wipe_disk != "yes-i-really-really-mean-it"
@@ -81,7 +81,7 @@
               ceph_osd_wipe_disk: 'yes-i-really-really-mean-it' within globals.yml)
   with_items: "{{ osds_cache_bootstrap|default([]) }}"
   when:
-    - item.external_journal | bool == False
+    - not item.external_journal | bool
     - ansible_devices[item.device.split('/')[2]].partitions|count > 1
     - ceph_osd_wipe_disk != "yes-i-really-really-mean-it"
 
diff --git a/ansible/roles/common/tasks/config.yml b/ansible/roles/common/tasks/config.yml
index e8b4621754..06a275cb46 100644
--- a/ansible/roles/common/tasks/config.yml
+++ b/ansible/roles/common/tasks/config.yml
@@ -47,7 +47,7 @@
       enabled: true
     - name: "01-es"
       enabled: "{{ enable_elasticsearch | bool or
-                ( elasticsearch_address != kolla_internal_vip_address ) | bool }}"
+                ( elasticsearch_address != kolla_internal_vip_address ) }}"
   notify:
     - Restart fluentd container
 
diff --git a/ansible/roles/keystone/tasks/config.yml b/ansible/roles/keystone/tasks/config.yml
index 6f9ce59158..7a9e4dd389 100644
--- a/ansible/roles/keystone/tasks/config.yml
+++ b/ansible/roles/keystone/tasks/config.yml
@@ -138,7 +138,7 @@
   when:
     - inventory_hostname in groups[keystone.group]
     - keystone.enabled | bool
-    - check_keystone_paste_ini.stat.exists | bool
+    - check_keystone_paste_ini.stat.exists
   notify:
     - Restart keystone container
 
diff --git a/ansible/roles/nova/tasks/config.yml b/ansible/roles/nova/tasks/config.yml
index 29f5bc6294..5b12ad20a3 100644
--- a/ansible/roles/nova/tasks/config.yml
+++ b/ansible/roles/nova/tasks/config.yml
@@ -138,7 +138,7 @@
   when:
     - inventory_hostname in groups[item.value.group]
     - item.value.enabled | bool
-    - nova_policy.stat.exists | bool
+    - nova_policy.stat.exists
     - item.key in services_require_policy_json
   with_dict: "{{ nova_services }}"
   notify:
diff --git a/ansible/roles/nova/tasks/deploy.yml b/ansible/roles/nova/tasks/deploy.yml
index 35e32efc51..1a246a407b 100644
--- a/ansible/roles/nova/tasks/deploy.yml
+++ b/ansible/roles/nova/tasks/deploy.yml
@@ -12,7 +12,7 @@
 
 - include: external-ceph.yml
   when:
-    - enable_ceph | bool == False and nova_backend == "rbd"
+    - not enable_ceph | bool and nova_backend == "rbd"
     - inventory_hostname in groups['compute']
 
 - include: register.yml
diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml
index 17de9774a9..fe9b84614e 100644
--- a/etc/kolla/globals.yml
+++ b/etc/kolla/globals.yml
@@ -182,7 +182,7 @@ kolla_internal_vip_address: "10.10.10.254"
 #enable_neutron_vpnaas: "no"
 #enable_nova_serialconsole_proxy: "no"
 #enable_octavia: "no"
-#enable_openvswitch: "{{ neutron_plugin_agent != 'linuxbridge' | bool }}"
+#enable_openvswitch: "{{ neutron_plugin_agent != 'linuxbridge' }}"
 #enable_osprofiler: "no"
 #enable_panko: "no"
 #enable_rally: "no"
-- 
GitLab