From 851bd0953a617586e9801411f0e92e6f0a96f574 Mon Sep 17 00:00:00 2001 From: Quique Llorente Date: Wed, 7 Nov 2018 14:43:34 +0100 Subject: [PATCH] Use correct python version for puppet-docker.py Now that we are running this at fedora28 with python3 we need to use python3 to run python scripts at playbooks Depends-On: I2c471724374da44eeddc4680b268bc362572ee27 Closes-Bug: #1802531 Change-Id: I42b18b228bfe361d19b580a853328c1a6c896257 --- common/deploy-steps-tasks.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/common/deploy-steps-tasks.yaml b/common/deploy-steps-tasks.yaml index 8b728ab175..e669f1ced8 100644 --- a/common/deploy-steps-tasks.yaml +++ b/common/deploy-steps-tasks.yaml @@ -3,6 +3,20 @@ ################################################## # Step 1 block, write data for subsequent steps ################################################## + - name: gather facts needed by role + setup: + gather_subset: "!min,python" + when: ansible_python is not defined + + - name: set python_cmd + set_fact: + python_cmd: "python{{ ansible_python.version.major }}" + cacheable: true + when: python_cmd is not defined + + - name: print python facts + debug: + msg: "python_cmd: {{ python_cmd }}" - name: Write config data at the start of step 1 when: step == "1" @@ -385,7 +399,7 @@ ###################################### - name: Run docker-puppet tasks (generate config) during step {{ step }} - shell: python /var/lib/docker-puppet/docker-puppet.py + shell: "{{ python_cmd }} /var/lib/docker-puppet/docker-puppet.py" environment: NET_HOST: 'true' DEBUG: '{{ docker_puppet_debug | default(false) }}' @@ -479,7 +493,7 @@ - container_config_tasks - name: Run docker-puppet tasks (bootstrap tasks) for step {{ step }} - shell: python /var/lib/docker-puppet/docker-puppet.py + shell: "{{ python_cmd }} /var/lib/docker-puppet/docker-puppet.py" environment: CONFIG: /var/lib/docker-puppet/{{ ansible_check_mode | ternary('check-mode/', '') }}docker-puppet-tasks{{ step }}.json CONFIG_VOLUME_PREFIX: '/var/lib/config-data{{ ansible_check_mode | ternary("/check-mode", "") }}'