From 204150f8ea7ceb571f53e334d5163ec460b0bbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Fri, 18 Aug 2017 16:36:03 +0200 Subject: [PATCH] fix #8: update jinja to version 2.8 --- common/verify-local-requirements.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/common/verify-local-requirements.yml b/common/verify-local-requirements.yml index 12e6f3d..727ef46 100644 --- a/common/verify-local-requirements.yml +++ b/common/verify-local-requirements.yml @@ -6,13 +6,23 @@ - name: Check if jmespath is installed locally debug: msg={{dummy|json_query('@')}} - register: check + register: check_jmespath ignore_errors: yes vars: dummy: Hello World + - name: Check if jinja 2.8 is installed locally + debug: msg={{(dummy|selectattr("id", "equalto", "hello")|first)['value']}} + vars: + dummy: + - id: hello + value: Hello World + register: check_jinja28 + ignore_errors: yes + - set_fact: - jmespath_missing: '{{ check|failed }}' + jmespath_missing: '{{ check_jmespath|failed }}' + jinja28_missing: '{{ check_jinja28|failed }}' on_rhel7: '{{ ansible_distribution == ''RedHat'' and ansible_lsb.major_release|int == 7 }}' - debug: @@ -23,17 +33,26 @@ msg: "This playbook can install by itself the missing packages on RHEL 7.x but we are not on such system (detected OS : {{ansible_distribution}} {{ansible_distribution_version}}). See https://github.com/nmasse-itix/OpenShift-Lab/issues/5 for more information." when: 'jmespath_missing and not on_rhel7' + - fail: + msg: "This playbook can install by itself the missing packages on RHEL 7.x but we are not on such system (detected OS : {{ansible_distribution}} {{ansible_distribution_version}}). See https://github.com/nmasse-itix/OpenShift-Lab/issues/8 for more information." + when: 'jinja28_missing and not on_rhel7' + - name: Enable the RHSCL repo command: subscription-manager repos --enable rhel-server-rhscl-7-rpms become: yes - when: 'jmespath_missing and on_rhel7' + when: '(jmespath_missing or jinja28_missing) and on_rhel7' - name: Install PIP yum: name=python27-python-pip state=installed become: yes - when: 'jmespath_missing and on_rhel7' + when: '(jmespath_missing or jinja28_missing) and on_rhel7' - name: Install JMESPATH command: 'scl enable python27 ''pip install --install-option="--install-purelib=/usr/lib/python2.7/site-packages/" jmespath'' ' become: yes when: 'jmespath_missing and on_rhel7' + + - name: Update jinja to versions 2.8 + command: 'scl enable python27 ''pip install --install-option="--install-purelib=/usr/lib/python2.7/site-packages/" jinja2'' ' + become: yes + when: 'jinja28_missing and on_rhel7'