summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2021-02-25 02:59:50 +0100
committerSuren A. Chilingaryan <csa@suren.me>2021-02-25 02:59:50 +0100
commitb87109ff07443670a0c9ad0ab8ddfda548fa16c5 (patch)
treedae10d9213ff974e1b17bbe927cdc712820a0ba8
parent1fb49d8220cad74d7221863754c919e3195a3d37 (diff)
downloadands-b87109ff07443670a0c9ad0ab8ddfda548fa16c5.tar.gz
ands-b87109ff07443670a0c9ad0ab8ddfda548fa16c5.tar.bz2
ands-b87109ff07443670a0c9ad0ab8ddfda548fa16c5.tar.xz
ands-b87109ff07443670a0c9ad0ab8ddfda548fa16c5.zip
Some changes of syntactic sugar for Ansible 3.9 compatibility
-rw-r--r--roles/ands_common/tasks/main.yml2
-rw-r--r--roles/ands_kaas/tasks/project.yml4
-rw-r--r--roles/ands_kaas/tasks/sync.yml2
-rw-r--r--roles/ands_kaas/tasks/template.yml4
-rw-r--r--roles/ands_kaas/tasks/volume.yml14
-rw-r--r--roles/ands_network/tasks/common.yml2
-rw-r--r--roles/ands_network/tasks/firewall_service.yml4
-rw-r--r--roles/ands_network/tasks/nm_configure_connection.yml10
-rw-r--r--roles/ands_openshift/tasks/heketi_resources.yml18
-rw-r--r--roles/ands_openshift/tasks/projects_resources.yml2
-rw-r--r--roles/ands_openshift/tasks/ssh.yml4
-rw-r--r--roles/ands_openshift/tasks/storage_resources.yml4
-rw-r--r--roles/ands_openshift/tasks/users_resources.yml2
-rw-r--r--roles/docker/tasks/configure.yml4
-rw-r--r--roles/docker/tasks/install.yml2
-rw-r--r--roles/glusterfs/tasks/migrate.yml4
-rw-r--r--roles/openshift_resource/tasks/command.yml4
-rw-r--r--roles/openshift_resource/tasks/lookup.yml2
-rw-r--r--roles/openshift_resource/tasks/patch.yml2
-rw-r--r--roles/openshift_resource/tasks/resource.yml2
-rw-r--r--roles/openshift_resource/tasks/template.yml8
21 files changed, 50 insertions, 50 deletions
diff --git a/roles/ands_common/tasks/main.yml b/roles/ands_common/tasks/main.yml
index 4027b7a..38f7059 100644
--- a/roles/ands_common/tasks/main.yml
+++ b/roles/ands_common/tasks/main.yml
@@ -33,7 +33,7 @@
# We always update on first install and if requested
- name: Update CentOS
yum: name=* state=latest update_cache=yes
- when: (result | changed) or (os_update | default(false))
+ when: (result is changed) or (os_update | default(false))
#- name: Add NodeJS required by a few used Ansible extensions
# package: name={{item}} state=present
diff --git a/roles/ands_kaas/tasks/project.yml b/roles/ands_kaas/tasks/project.yml
index 5a83dff..744a20a 100644
--- a/roles/ands_kaas/tasks/project.yml
+++ b/roles/ands_kaas/tasks/project.yml
@@ -1,13 +1,13 @@
---
- name: Load global variables
include_vars: "{{kaas_project_path}}/vars/globals.yml"
- when: path | is_file
+ when: path is file
vars:
path: "{{ kaas_project_path }}/vars/globals.yml"
- name: Load variables
include_vars: dir="{{kaas_project_path}}/vars" name="var_{{kaas_project}}_config"
- when: path | is_dir
+ when: path is directory
vars:
path: "{{ kaas_project_path }}/vars"
diff --git a/roles/ands_kaas/tasks/sync.yml b/roles/ands_kaas/tasks/sync.yml
index 8caefe9..bfc1a03 100644
--- a/roles/ands_kaas/tasks/sync.yml
+++ b/roles/ands_kaas/tasks/sync.yml
@@ -21,6 +21,6 @@
group: "{{ gid }}"
register: chmod
when:
- - sync | changed
+ - sync is changed
- kaas_openshift_gid_ranges[kaas_project] is defined
- kaas_project_config.sync_set_gid | default(false)
diff --git a/roles/ands_kaas/tasks/template.yml b/roles/ands_kaas/tasks/template.yml
index a12b192..6255123 100644
--- a/roles/ands_kaas/tasks/template.yml
+++ b/roles/ands_kaas/tasks/template.yml
@@ -19,8 +19,8 @@
template: "{{ dest_name }}"
template_path: "{{ kaas_template_path }}"
project: "{{ kaas_namespace | default(kaas_project) }}"
- recreate: "{{ result | changed | ternary (delete | default(true) | ternary(true, false), false) }}"
- replace: "{{ result | changed | ternary (delete | default(true) | ternary(false, true), false) }}"
+ recreate: "{{ result is changed | ternary (delete | default(true) | ternary(true, false), false) }}"
+ replace: "{{ result is changed | ternary (delete | default(true) | ternary(false, true), false) }}"
# alternatively load template
# TODO
diff --git a/roles/ands_kaas/tasks/volume.yml b/roles/ands_kaas/tasks/volume.yml
index 2c695f2..d6e99e7 100644
--- a/roles/ands_kaas/tasks/volume.yml
+++ b/roles/ands_kaas/tasks/volume.yml
@@ -24,7 +24,7 @@
group: "{{ volume.group | default(kaas_project_config.file_group) | default(default_group) }}"
register: chmod
when:
- - mkdir | changed
+ - mkdir is changed
- kaas_openshift_gid_ranges[kaas_project] is defined
- osvpath[:1] != "/"
@@ -41,19 +41,19 @@
owner: "{{ volume.owner | default(kaas_project_config.file_owner) | default(kaas_default_file_owner) }}"
group: "{{ volume.group | default(kaas_project_config.file_group) | default(kaas_default_file_group) }}"
when:
- - mkdir | changed
- - chmod | skipped
+ - mkdir is changed
+ - chmod is skipped
- name: "Setting SELinux context for non standard locations"
sefcontext: target="{{ hostpath }}" setype="svirt_sandbox_file_t" state="present" reload="yes"
when:
- - mkdir | changed
- - chmod | skipped
+ - mkdir is changed
+ - chmod is skipped
- voltype[0] == "host"
- name: "Apply SELinux context for non standard locations"
shell: restorecon "{{ hostpath }}"
when:
- - mkdir | changed
- - chmod | skipped
+ - mkdir is changed
+ - chmod is skipped
- voltype[0] == "host"
diff --git a/roles/ands_network/tasks/common.yml b/roles/ands_network/tasks/common.yml
index 03d9fb4..11caac5 100644
--- a/roles/ands_network/tasks/common.yml
+++ b/roles/ands_network/tasks/common.yml
@@ -30,7 +30,7 @@
- name: Provision /etc/hosts with load-balance IP on non master servers
lineinfile: dest="/etc/hosts" line="{{ ands_inner_lb_ip }} {{ openshift_master_cluster_hostname }}" regexp=".*{{ openshift_master_cluster_hostname }}$" state="present"
- when: (result | skipped) and (ands_use_inner_lb | default(false))
+ when: (result is skipped) and (ands_use_inner_lb | default(false))
- name: Provision inner load-balancer hostname in /etc/hosts
lineinfile: dest="/etc/hosts" line="{{ ands_inner_lb_ip }} {{ ands_inner_lb_hostname }} {{ ands_inner_lb_fqdn }}" regexp=".*{{ ands_inner_lb_fqdn }}$" state="present"
diff --git a/roles/ands_network/tasks/firewall_service.yml b/roles/ands_network/tasks/firewall_service.yml
index d3c6e9b..80612e7 100644
--- a/roles/ands_network/tasks/firewall_service.yml
+++ b/roles/ands_network/tasks/firewall_service.yml
@@ -6,8 +6,8 @@
command: "firewall-offline-cmd --remove-service={{ service }}"
when:
- service in servicelist
- - result | changed
+ - result is changed
- name: "Create firewalld service '{{ service }}'"
command: "firewall-offline-cmd --new-service-from-file='{{ firewall_template_path }}/{{ service }}.xml' --name={{ service }}"
- when: (service not in servicelist) or (result | changed)
+ when: (service not in servicelist) or (result is changed)
diff --git a/roles/ands_network/tasks/nm_configure_connection.yml b/roles/ands_network/tasks/nm_configure_connection.yml
index 9354fbf..b2f2e9f 100644
--- a/roles/ands_network/tasks/nm_configure_connection.yml
+++ b/roles/ands_network/tasks/nm_configure_connection.yml
@@ -32,21 +32,21 @@
command: "nmcli connection add type bridge ifname {{ bridge | quote }} con-name {{ name }} ip4 {{ cidr }}"
when:
- bridge is defined
- - (conres.rc != 0) or (not (delres | skipped))
+ - (conres.rc != 0) or (not (delres is skipped))
- (conres.rc != 0) or (not (alias | default(false)))
- name: "connect bridge '{{ bridge }}' to interface '{{ iface }}'"
command: "nmcli connection add type bridge-slave ifname {{ iface | quote }} master {{ bridge | quote }}"
when:
- bridge is defined
- - (conres.rc != 0) or (not (delres | skipped))
+ - (conres.rc != 0) or (not (delres is skipped))
- (conres.rc != 0) or (not (alias | default(false)))
- name: "configure network interface '{{ iface }}' to '{{ cidr }}'"
command: "nmcli connection add type infiniband ifname {{ iface | quote }} con-name {{ name }} ip4 {{ cidr }}"
when:
- bridge is not defined
- - (conres.rc != 0) or (not (delres | skipped))
+ - (conres.rc != 0) or (not (delres is skipped))
- (conres.rc != 0) or (not (alias | default(false)))
- name: "add ip alias '{{ cidr }}' to connection '{{ conres.stdout }}' using interface '{{ iface }}'"
@@ -63,6 +63,6 @@
vars:
cname: "{{ (conres.stdout == '') | ternary(name, conres.stdout) }}"
when:
- - not(alres | skipped)
- - alres | succeeded
+ - not(alres is skipped)
+ - alres is succeeded
- not ip_present
diff --git a/roles/ands_openshift/tasks/heketi_resources.yml b/roles/ands_openshift/tasks/heketi_resources.yml
index 0b0d0d3..1cab748 100644
--- a/roles/ands_openshift/tasks/heketi_resources.yml
+++ b/roles/ands_openshift/tasks/heketi_resources.yml
@@ -6,11 +6,11 @@
command: oc -n "{{ openshift_namespace }}" get secret/heketi
register: result
failed_when: false
- changed_when: (result | failed)
+ changed_when: result is failed
- name: Create secret for dynamic volume provisioning
command: "kubectl create secret generic heketi --type=kubernetes.io/glusterfs --from-literal=key={{ ands_secrets.heketi.admin | quote }} --from-literal=user={{ ands_secrets.heketi.user | quote }} --namespace={{ openshift_namespace }}"
- when: (result | changed)
+ when: (result is changed)
- name: Copy Heketi configuration
copy: src="heketi/heketi.json" dest="{{ heketi_template_path }}/heketi.json" owner=root group=root mode="0644"
@@ -20,21 +20,21 @@
command: oc -n "{{ openshift_namespace }}" get cm/heketi
register: result2
failed_when: false
- changed_when: (result2 | failed)
+ changed_when: result2 is failed
- name: Desotry existing Heketi configuration
command: oc -n "{{ openshift_namespace }}" delete cm/heketi
- when: ( result1 | changed ) and (not (result2 | changed))
+ when: ( result1 is changed ) and (not (result2 is changed))
- name: Create heketiConfigmap
command: oc -n "{{ openshift_namespace }}" create cm heketi --from-file="{{ heketi_template_path }}/heketi.json"
- when: (result1 | changed) or (result2 | changed)
+ when: (result1 is changed) or (result2 is changed)
- name: Check if Heketi POD is running
command: oc -n "{{ openshift_namespace }}" get dc/heketi --template "{{ '{{.status.availableReplicas}}' }}"
register: result
failed_when: false
- changed_when: (result | failed) or ((result.stdout | int) < 1)
+ changed_when: (result is failed) or ((result.stdout | int) < 1)
- name: Fix GlusterFS volume permissions
include_tasks: heketi_perms.yml
@@ -42,7 +42,7 @@
apply:
run_once: true
delegate_to: "{{ groups.masters[0] }}"
- when: (result | changed)
+ when: (result is changed)
- name: Copy Heketi Template
template: src="heketi/heketi_template.json.j2" dest="{{ heketi_template_path }}/heketi_template.json" owner=root group=root mode="0644"
@@ -54,7 +54,7 @@
template: heketi_template.json
template_path: "{{ heketi_template_path }}"
project: "{{ openshift_namespace }}"
- recreate: "{{ result | changed | ternary (true, false) }}"
+ recreate: "{{ result is changed | ternary (true, false) }}"
- name: Wait until heketi service is running
wait_for: host="heketi.{{ openshift_master_default_subdomain }}" port=80 state=present
@@ -73,4 +73,4 @@
template: heketi-sc.yml
template_path: "{{ heketi_template_path }}"
project: "{{ openshift_namespace }}"
- recreate: "{{ result | changed | ternary (true, false) }}"
+ recreate: "{{ result is changed | ternary (true, false) }}"
diff --git a/roles/ands_openshift/tasks/projects_resources.yml b/roles/ands_openshift/tasks/projects_resources.yml
index 2afe9e1..d5b4580 100644
--- a/roles/ands_openshift/tasks/projects_resources.yml
+++ b/roles/ands_openshift/tasks/projects_resources.yml
@@ -5,7 +5,7 @@
- name: Find missing projects
set_fact: new_projects="{{ ands_openshift_projects.keys() | difference (results.stdout | from_json | json_query('items[*].metadata.name')) }}"
- when: (results | succeeded)
+ when: results is succeeded
- name: Create missing projects
command: "oc adm new-project --description '{{ ands_openshift_projects[item] }}' {{ item }}"
diff --git a/roles/ands_openshift/tasks/ssh.yml b/roles/ands_openshift/tasks/ssh.yml
index 97f3926..c3b35c3 100644
--- a/roles/ands_openshift/tasks/ssh.yml
+++ b/roles/ands_openshift/tasks/ssh.yml
@@ -4,7 +4,7 @@
delegate_to: "{{ groups.masters[0] }}"
command: oc -n "{{ openshift_namespace }}" get secret/ands-ssh
register: result
- changed_when: (result | failed)
+ changed_when: result is failed
failed_when: false
- include_tasks: ssh_keygen.yml
@@ -12,7 +12,7 @@
apply:
run_once: true
delegate_to: "{{ groups.masters[0] }}"
- when: (result | changed)
+ when: (result is changed)
- name: Read SSH public key
shell: cat "{{ ssh_template_path }}/id_rsa.pub"
diff --git a/roles/ands_openshift/tasks/storage_resources.yml b/roles/ands_openshift/tasks/storage_resources.yml
index c83c677..3b051d8 100644
--- a/roles/ands_openshift/tasks/storage_resources.yml
+++ b/roles/ands_openshift/tasks/storage_resources.yml
@@ -12,7 +12,7 @@
template: gfs-svc.yml
template_path: "{{ storage_template_path }}"
project: "{{ prj_item }}"
- recreate: "{{ result | changed | ternary (true, false) }}"
+ recreate: "{{ result is changed | ternary (true, false) }}"
with_items: "{{ ands_openshift_projects.keys() }}"
loop_control:
loop_var: prj_item
@@ -27,7 +27,7 @@
template: gfs-ep.yml
template_path: "{{ storage_template_path }}"
project: "{{ prj_item }}"
- recreate: "{{ result | changed | ternary (true, false) }}"
+ recreate: "{{ result is changed | ternary (true, false) }}"
with_items: "{{ ands_openshift_projects.keys() }}"
loop_control:
loop_var: prj_item
diff --git a/roles/ands_openshift/tasks/users_resources.yml b/roles/ands_openshift/tasks/users_resources.yml
index 2a73cd0..3552ce1 100644
--- a/roles/ands_openshift/tasks/users_resources.yml
+++ b/roles/ands_openshift/tasks/users_resources.yml
@@ -20,7 +20,7 @@
- name: Find removed users
set_fact: removed_users="{{ results.stdout | from_json | json_query('items[*].metadata.name') | difference(ands_openshift_users.keys()) }}"
- when: (results | succeeded)
+ when: results is succeeded
- name: Remove user authentication
command: "oc delete identity htpasswd_auth:{{ item }}"
diff --git a/roles/docker/tasks/configure.yml b/roles/docker/tasks/configure.yml
index fa31b1d..04eeafe 100644
--- a/roles/docker/tasks/configure.yml
+++ b/roles/docker/tasks/configure.yml
@@ -33,8 +33,8 @@
lv: "{{ ansible_lvm['lvs'][docker_lv] | default({}) }}"
vg: "{{ lv['vg'] | default('') }}"
when:
- - docker_install_result | changed
- - docker_start_result | changed
+ - docker_install_result is changed
+ - docker_start_result is changed
- ansible_lvm['lvs'][docker_lv] is not defined
# Pass option docker_reconfigure to run this...
diff --git a/roles/docker/tasks/install.yml b/roles/docker/tasks/install.yml
index 41ae5a3..7f71a96 100644
--- a/roles/docker/tasks/install.yml
+++ b/roles/docker/tasks/install.yml
@@ -3,7 +3,7 @@
register: result
when: update | default(false)
failed_when: false
- changed_when: result | failed
+ changed_when: result is failed
- name: Ensure docker is installed
yum: name="docker{{ docker_version | default('') }}" state="{{ ((docker_version is defined) and (update | default(false))) | ternary('latest', 'present') }}"
diff --git a/roles/glusterfs/tasks/migrate.yml b/roles/glusterfs/tasks/migrate.yml
index 3ef7917..163125f 100644
--- a/roles/glusterfs/tasks/migrate.yml
+++ b/roles/glusterfs/tasks/migrate.yml
@@ -3,11 +3,11 @@
#- name: Detect if source host {{ glusterfs_migrate_from }} is failed or running
# wait_for: host={{ glusterfs_migrate_from }} port=24007 timeout=1
# register: srcres
-# changed_when: srcres | failed
+# changed_when: srcres is failed
# failed_when: false
#- set_fact:
-# glusterfs_migrate_failed: "{{ srcres | changed }}"
+# glusterfs_migrate_failed: "{{ srcres is changed }}"
- set_fact:
glusterfs_migrate_failed: "1"
diff --git a/roles/openshift_resource/tasks/command.yml b/roles/openshift_resource/tasks/command.yml
index c8e8d04..2c51665 100644
--- a/roles/openshift_resource/tasks/command.yml
+++ b/roles/openshift_resource/tasks/command.yml
@@ -4,7 +4,7 @@
command: "oc get -n {{project}} {{resource}}"
register: result
failed_when: false
- changed_when: (result | failed)
+ changed_when: result is failed
- name: Detroy existing resources
command: "oc delete -n {{project}} {{resource}}"
@@ -13,5 +13,5 @@
- name: Executing command
command: "oc -n {{ project }} {{ command }}"
- when: (recreate|default(false)) or (result | changed)
+ when: (recreate|default(false)) or (result is changed)
run_once: true
diff --git a/roles/openshift_resource/tasks/lookup.yml b/roles/openshift_resource/tasks/lookup.yml
index 07beb81..c5eb2a3 100644
--- a/roles/openshift_resource/tasks/lookup.yml
+++ b/roles/openshift_resource/tasks/lookup.yml
@@ -3,4 +3,4 @@
command: "oc get -n {{project}} {{rkind}}/{{rname}}"
register: result
failed_when: false
- changed_when: (result | failed)
+ changed_when: result is failed
diff --git a/roles/openshift_resource/tasks/patch.yml b/roles/openshift_resource/tasks/patch.yml
index 501f692..76d010e 100644
--- a/roles/openshift_resource/tasks/patch.yml
+++ b/roles/openshift_resource/tasks/patch.yml
@@ -36,6 +36,6 @@
- name: "Patch {{resource}} in {{project}}"
command: "oc patch -n '{{project}}' '{{resource}}' --patch '{{xpatch}}'"
register: result
- changed_when: (result | succeeded)
+ changed_when: result is succeeded
when: dummy_result.stdout != patch_result.stdout
\ No newline at end of file
diff --git a/roles/openshift_resource/tasks/resource.yml b/roles/openshift_resource/tasks/resource.yml
index 416f485..03420a9 100644
--- a/roles/openshift_resource/tasks/resource.yml
+++ b/roles/openshift_resource/tasks/resource.yml
@@ -13,7 +13,7 @@
command: "oc delete -n {{project}} {{rkind}}/{{rname}}"
register: rm_result
failed_when: false
- changed_when: (rm_result | succeeded)
+ changed_when: rm_result is succeeded
when: (recreate|default(false))
- name: "Populate resources defined in {{ template }} to {{project}} ({{ replace | default(false) | ternary('replace', 'create') }})"
diff --git a/roles/openshift_resource/tasks/template.yml b/roles/openshift_resource/tasks/template.yml
index f593544..b3838b5 100644
--- a/roles/openshift_resource/tasks/template.yml
+++ b/roles/openshift_resource/tasks/template.yml
@@ -12,14 +12,14 @@
command: "oc get -n {{project}} {{item.kind}}/{{item.name}}"
register: results
failed_when: false
- changed_when: (results | failed)
+ changed_when: results is failed
with_items: "{{ resources | default([]) }}"
- name: "{{ template }}: Detroy existing resources in {{project}}"
command: "oc delete -n {{project}} {{resources[item|int].kind}}/{{resources[item|int].name}}"
failed_when: false
with_sequence: start=0 count="{{resources | default([]) | length}}"
- when: ((recreate|default(false)) or (results | changed)) and (results.results[item|int].rc == 0)
+ when: ((recreate|default(false)) or (results is changed)) and (results.results[item|int].rc == 0)
# Replace often complains on various immutable variables it can't change. We ignore.
- name: "{{ template }}: Populate resources to {{project}} ({{ replace | default(false) | ternary('replace', 'create') }})"
@@ -27,14 +27,14 @@
register: status
failed_when: (status.rc != 0) and not (replace | default(false))
when:
- - (recreate | default(false)) or (replace | default(false)) or (results | changed)
+ - (recreate | default(false)) or (replace | default(false)) or (results is changed)
- resources | length > 0
# Replace will not create missing resources. We need to create here.
- name: "{{ template }}: Populate missing resources to {{project}} ({{ replace | default(false) | ternary('replace', 'create') }})"
shell: "oc process -n {{project}} -f '{{ template_path }}/{{template}}' {{ template_args | default('') }} | oc create -n {{project}} -f - {{ create_args | default('') }}"
when:
- - (replace | default(false)) and (results | changed)
+ - (replace | default(false)) and (results is changed)
- resources | length > 0