7683b8bcaa
The container-puppet tasks only need to be run if tasks actually exist, which
is already being checked on the ansible control node.
A "when" statement is then applied to the set of tasks necessary to run
the container-puppet tasks, when the tasks are actually defined.
This patch moves that set of tasks to a separate tasks file and uses a
dynamic include. This results in less tasks being skipped, which can
save several minutes at scale. This results in 3 less tasks that need to
be skipped at steps 1-5, which equates to 15 tasks overall, when no
container-puppet tasks actually exist.
When container-puppet tasks do exist, all the tasks will be executed as
necessary.
Change-Id: Ifad32bf79942cde58295fd9aae7e23e2f62c1ae2
(cherry picked from commit 1602d68daa
)
49 lines
1.8 KiB
YAML
49 lines
1.8 KiB
YAML
- name: Write container-puppet-tasks json file for {{ansible_hostname}} step {{step}}
|
|
no_log: True
|
|
copy:
|
|
content: "{{host_container_puppet_tasks|to_nice_json}}"
|
|
dest: "/var/lib/container-puppet/container-puppet-tasks{{step}}.json"
|
|
force: yes
|
|
mode: '0600'
|
|
tags:
|
|
- container_config_tasks
|
|
|
|
- name: Run container-puppet tasks (bootstrap tasks) for step {{ step }}
|
|
async: 3600
|
|
poll: 0
|
|
shell: "{{ python_cmd }} /var/lib/container-puppet/container-puppet.py"
|
|
environment:
|
|
CONFIG: /var/lib/container-puppet/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}container-puppet-tasks{{ step }}.json
|
|
CONFIG_VOLUME_PREFIX: '/var/lib/config-data{{ ansible_check_mode | bool | ternary("/check-mode", "") }}'
|
|
NET_HOST: "true"
|
|
NO_ARCHIVE: "true"
|
|
STEP: "{{ step }}"
|
|
CONTAINER_CLI: "{{ container_cli }}"
|
|
DEBUG: "{{ docker_puppet_debug }}"
|
|
MOUNT_HOST_PUPPET: '{{docker_puppet_mount_host_puppet}}'
|
|
SHORT_HOSTNAME: "{{ ansible_hostname }}"
|
|
PROCESS_COUNT: "{{ docker_puppet_process_count }}"
|
|
register: bootstrap_tasks_async_result
|
|
no_log: true
|
|
tags:
|
|
- container_config_tasks
|
|
|
|
- name: Wait for container-puppet tasks (bootstrap tasks) for step {{ step }} to finish
|
|
async_status:
|
|
jid: "{{ bootstrap_tasks_async_result.ansible_job_id }}"
|
|
register: bootstrap_tasks_outputs
|
|
until: bootstrap_tasks_outputs.finished
|
|
retries: 1200
|
|
delay: 3
|
|
tags:
|
|
- container_config_tasks
|
|
|
|
- name: "Debug output for task: Run container-puppet tasks (bootstrap tasks) for step {{ step }}"
|
|
debug:
|
|
var: bootstrap_tasks_outputs.stdout_lines | default([]) | union(bootstrap_tasks_outputs.stderr_lines | default([]))
|
|
when:
|
|
- bootstrap_tasks_outputs.rc is defined
|
|
failed_when: bootstrap_tasks_outputs.rc != 0
|
|
tags:
|
|
- container_config_tasks
|