From 4b6eb4ca9fedfc84411f577370b287c9296427c5 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Tue, 10 Dec 2019 20:38:22 -0500 Subject: [PATCH] Move some common tasks to step 1 These tasks in deploy-steps-tasks.yaml currently run at every step, but they only actually need to run once. This patch moves them to deploy-steps-tasks-step-1.yaml so that they are only run at step1 and do not need to be skipped at every later step. Change-Id: Ib64d1969c5dff3901829583fc2db2f6e2a3acbb3 (cherry picked from commit af88862d9b27657160c47c9bab249af246af76f8) --- common/deploy-steps-tasks-step-1.yaml | 61 ++++++++++++++++++++++++++ common/deploy-steps-tasks.yaml | 63 --------------------------- 2 files changed, 61 insertions(+), 63 deletions(-) diff --git a/common/deploy-steps-tasks-step-1.yaml b/common/deploy-steps-tasks-step-1.yaml index 1c895f9d31..7d2d2cc064 100644 --- a/common/deploy-steps-tasks-step-1.yaml +++ b/common/deploy-steps-tasks-step-1.yaml @@ -291,3 +291,64 @@ label: "{{ item[0] }}" tags: - container_startup_configs + + - name: gather facts needed by role + setup: + gather_subset: "!min,python" + when: ansible_python is not defined + tags: + - container_config_tasks + + - name: set python_cmd + set_fact: + python_cmd: "python{{ ansible_python.version.major }}" + cacheable: true + when: python_cmd is not defined + tags: + - container_config_tasks + + - name: Set host puppet debugging fact string + set_fact: + host_puppet_config_debug: "--debug --verbose" + when: + - enable_puppet | bool + - enable_debug | bool + tags: + - host_config + + - name: Check for /etc/puppet/check-mode directory for check mode + stat: + path: /etc/puppet/check-mode + register: check_mode_dir + when: ansible_check_mode|bool + tags: + - host_config + - container_config + + - name: Create /etc/puppet/check-mode/hieradata directory for check mode + file: + path: /etc/puppet/check-mode/hieradata + state: directory + setype: svirt_sandbox_file_t + selevel: s0 + recurse: true + check_mode: no + when: + - ansible_check_mode|bool + - not check_mode_dir.stat.exists + tags: + - host_config + - container_config + + - name: Create puppet check-mode files if they don't exist for check mode + shell: | + cp -a /etc/puppet/hiera.yaml /etc/puppet/check-mode/hiera.yaml + cp -a /etc/puppet/hieradata/* /etc/puppet/check-mode/hieradata/ + sed -i 's/\/etc\/puppet\/hieradata/\/etc\/puppet\/check-mode\/hieradata/' /etc/puppet/check-mode/hiera.yaml + when: + - ansible_check_mode|bool + - not check_mode_dir.stat.exists + check_mode: no + tags: + - host_config + - container_config diff --git a/common/deploy-steps-tasks.yaml b/common/deploy-steps-tasks.yaml index e6a39c93d7..6633ca10b7 100644 --- a/common/deploy-steps-tasks.yaml +++ b/common/deploy-steps-tasks.yaml @@ -1,60 +1,10 @@ # Note the indentation here is required as it's joined # to create a playbook in deploy-steps.j2 - ################################################## - # 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 - tags: - - container_config_tasks - - - name: set python_cmd - set_fact: - python_cmd: "python{{ ansible_python.version.major }}" - cacheable: true - when: python_cmd is not defined - tags: - - container_config_tasks ##################################################### # Per step puppet configuration of the baremetal host ##################################################### - - name: Set host puppet debugging fact string - set_fact: - host_puppet_config_debug: "--debug --verbose" - when: - - enable_puppet | bool - - enable_debug | bool - tags: - - host_config - - - name: Check for /etc/puppet/check-mode directory for check mode - stat: - path: /etc/puppet/check-mode - register: check_mode_dir - when: ansible_check_mode|bool - tags: - - host_config - - container_config - - - name: Create /etc/puppet/check-mode/hieradata directory for check mode - file: - path: /etc/puppet/check-mode/hieradata - state: directory - setype: svirt_sandbox_file_t - selevel: s0 - recurse: true - check_mode: no - when: - - ansible_check_mode|bool - - not check_mode_dir.stat.exists - tags: - - host_config - - container_config - - name: Write the config_step hieradata no_log: True copy: @@ -66,19 +16,6 @@ tags: - host_config - - name: Create puppet check-mode files if they don't exist for check mode - shell: | - cp -a /etc/puppet/hiera.yaml /etc/puppet/check-mode/hiera.yaml - cp -a /etc/puppet/hieradata/* /etc/puppet/check-mode/hieradata/ - sed -i 's/\/etc\/puppet\/hieradata/\/etc\/puppet\/check-mode\/hieradata/' /etc/puppet/check-mode/hiera.yaml - when: - - ansible_check_mode|bool - - not check_mode_dir.stat.exists - check_mode: no - tags: - - host_config - - container_config - - name: Run puppet host configuration for step {{ step }} when: enable_puppet|bool shell: >-