From c3c88fb35f8f8541b066b6a25f976e53b1813d1d Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Wed, 20 Jul 2016 14:09:23 -0400 Subject: Check ansible version prior to evaluating cluster hosts and groups. --- playbooks/aws/openshift-cluster/config.yml | 3 +++ playbooks/byo/openshift-cluster/config.yml | 2 ++ playbooks/byo/openshift-cluster/upgrades/v3_2/upgrade.yml | 2 ++ playbooks/byo/openshift_facts.yml | 2 ++ playbooks/common/openshift-cluster/verify_ansible_version.yml | 10 ++++++++++ playbooks/libvirt/openshift-cluster/config.yml | 3 +++ playbooks/openstack/openshift-cluster/config.yml | 2 ++ roles/openshift_facts/tasks/main.yml | 5 ----- 8 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 playbooks/common/openshift-cluster/verify_ansible_version.yml diff --git a/playbooks/aws/openshift-cluster/config.yml b/playbooks/aws/openshift-cluster/config.yml index d6b5700b0..647c72239 100644 --- a/playbooks/aws/openshift-cluster/config.yml +++ b/playbooks/aws/openshift-cluster/config.yml @@ -1,3 +1,6 @@ +--- +- include: ../../common/openshift-cluster/verify_ansible_version.yml + - hosts: localhost gather_facts: no tasks: diff --git a/playbooks/byo/openshift-cluster/config.yml b/playbooks/byo/openshift-cluster/config.yml index 3477b2dc4..0a931fbe0 100644 --- a/playbooks/byo/openshift-cluster/config.yml +++ b/playbooks/byo/openshift-cluster/config.yml @@ -1,4 +1,6 @@ --- +- include: ../../common/openshift-cluster/verify_ansible_version.yml + - hosts: localhost connection: local become: no diff --git a/playbooks/byo/openshift-cluster/upgrades/v3_2/upgrade.yml b/playbooks/byo/openshift-cluster/upgrades/v3_2/upgrade.yml index 8c89e118e..ddb5ef911 100644 --- a/playbooks/byo/openshift-cluster/upgrades/v3_2/upgrade.yml +++ b/playbooks/byo/openshift-cluster/upgrades/v3_2/upgrade.yml @@ -1,4 +1,6 @@ --- +- include: ../../common/openshift-cluster/verify_ansible_version.yml + - hosts: localhost connection: local become: no diff --git a/playbooks/byo/openshift_facts.yml b/playbooks/byo/openshift_facts.yml index db8703db6..d966b58fd 100644 --- a/playbooks/byo/openshift_facts.yml +++ b/playbooks/byo/openshift_facts.yml @@ -1,4 +1,6 @@ --- +- include: ../common/openshift-cluster/verify_ansible_version.yml + - hosts: localhost connection: local become: no diff --git a/playbooks/common/openshift-cluster/verify_ansible_version.yml b/playbooks/common/openshift-cluster/verify_ansible_version.yml new file mode 100644 index 000000000..2a143b065 --- /dev/null +++ b/playbooks/common/openshift-cluster/verify_ansible_version.yml @@ -0,0 +1,10 @@ +--- +- hosts: localhost + connection: local + become: no + gather_facts: no + tasks: + - name: Verify Ansible version is greater than or equal to 2.1.0.0 + fail: + msg: "Unsupported ansible version: {{ ansible_version.full }} found" + when: not ansible_version.full | version_compare('2.1.0.0', 'ge') diff --git a/playbooks/libvirt/openshift-cluster/config.yml b/playbooks/libvirt/openshift-cluster/config.yml index a28e59a87..299325fc4 100644 --- a/playbooks/libvirt/openshift-cluster/config.yml +++ b/playbooks/libvirt/openshift-cluster/config.yml @@ -2,6 +2,9 @@ # TODO: need to figure out a plan for setting hostname, currently the default # is localhost, so no hostname value (or public_hostname) value is getting # assigned + +- include: ../../common/openshift-cluster/verify_ansible_version.yml + - hosts: localhost gather_facts: no tasks: diff --git a/playbooks/openstack/openshift-cluster/config.yml b/playbooks/openstack/openshift-cluster/config.yml index 1366c83ca..f6550b2c4 100644 --- a/playbooks/openstack/openshift-cluster/config.yml +++ b/playbooks/openstack/openshift-cluster/config.yml @@ -1,4 +1,6 @@ --- +- include: ../../common/openshift-cluster/verify_ansible_version.yml + - hosts: localhost gather_facts: no tasks: diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index 2aca35ce1..4dbbd7f45 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -1,9 +1,4 @@ --- -- name: Verify Ansible version is greater than or equal to 2.1.0.0 - fail: - msg: "Unsupported ansible version: {{ ansible_version.full }} found" - when: not ansible_version.full | version_compare('2.1.0.0', 'ge') - - name: Detecting Operating System stat: path: /run/ostree-booted -- cgit v1.2.3