Browse Source

Merge "Dynamically include container-puppet tasks"

tags/12.1.0
Zuul Gerrit Code Review 2 weeks ago
parent
commit
d578748bab
3 changed files with 51 additions and 49 deletions
  1. +2
    -49
      common/deploy-steps-tasks.yaml
  2. +1
    -0
      common/deploy-steps.j2
  3. +48
    -0
      common/host-container-puppet-tasks.yaml

+ 2
- 49
common/deploy-steps-tasks.yaml View File

@@ -172,55 +172,8 @@
tags:
- container_config_tasks

- 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
when: host_container_puppet_tasks is defined

- 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 }}"
- name: Include container-puppet tasks for step {{step}}
include_tasks: host-container-puppet-tasks.yaml
when: host_container_puppet_tasks is defined
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
when: host_container_puppet_tasks is defined
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:
- host_container_puppet_tasks is defined
- bootstrap_tasks_outputs.rc is defined
failed_when: bootstrap_tasks_outputs.rc != 0
tags:
- container_config_tasks

+ 1
- 0
common/deploy-steps.j2 View File

@@ -404,6 +404,7 @@ outputs:
deploy-artifacts.sh : {get_file: ../puppet/deploy-artifacts.sh}
hosts-config.sh: {get_file: ../scripts/hosts-config.sh}
generate-config-tasks: {get_file: generate-config-tasks.yaml}
host-container-puppet-tasks: {get_file: host-container-puppet-tasks.yaml}
deploy_steps_playbook:
str_replace:
params:


+ 48
- 0
common/host-container-puppet-tasks.yaml View File

@@ -0,0 +1,48 @@
- 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

Loading…
Cancel
Save