Add support to run Container Puppet tasks without Paunch
Deploy the container-puppet-* containers with tripleo-container-manage instead of container-puppet.py which uses Paunch. This is the last piece where Paunch isn't used anymore in the deployment. Change-Id: I6fdf03a639ca63047fdd6ef603f549781a06d07b
This commit is contained in:
parent
c48ccacf74
commit
ed720b0c83
|
@ -22,6 +22,10 @@ if [ -n "$PUPPET_TAGS" ]; then
|
||||||
TAGS="--tags \"$PUPPET_TAGS\""
|
TAGS="--tags \"$PUPPET_TAGS\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -z ${STEP_CONFIG+x} ]; then
|
||||||
|
echo -e "${STEP_CONFIG}" | tee /etc/config.pp
|
||||||
|
fi
|
||||||
|
|
||||||
CHECK_MODE=""
|
CHECK_MODE=""
|
||||||
if [ -d "/tmp/puppet-check-mode" ]; then
|
if [ -d "/tmp/puppet-check-mode" ]; then
|
||||||
mkdir -p /etc/puppet/check-mode
|
mkdir -p /etc/puppet/check-mode
|
||||||
|
|
|
@ -148,6 +148,7 @@
|
||||||
tripleo_container_manage_debug: "{{ enable_debug | bool }}"
|
tripleo_container_manage_debug: "{{ enable_debug | bool }}"
|
||||||
tripleo_container_manage_healthcheck_disabled: "{{ container_healthcheck_disabled | bool }}"
|
tripleo_container_manage_healthcheck_disabled: "{{ container_healthcheck_disabled | bool }}"
|
||||||
tripleo_container_manage_log_path: "{{ container_log_stdout_path }}"
|
tripleo_container_manage_log_path: "{{ container_log_stdout_path }}"
|
||||||
|
tripleo_container_manage_config_patterns: '*.json'
|
||||||
tags:
|
tags:
|
||||||
- container_startup_configs
|
- container_startup_configs
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,83 @@
|
||||||
- name: Run container-puppet tasks (generate config) during step 1
|
- name: Block for container-puppet tasks (generate config) during step 1 with paunch
|
||||||
async: 3600
|
when:
|
||||||
poll: 0
|
- enable_paunch|default(true)
|
||||||
shell: "{{ python_cmd }} /var/lib/container-puppet/container-puppet.py"
|
|
||||||
environment:
|
|
||||||
NET_HOST: 'true'
|
|
||||||
DEBUG: '{{ docker_puppet_debug | bool }}'
|
|
||||||
PROCESS_COUNT: "{{ docker_puppet_process_count }}"
|
|
||||||
CONTAINER_CLI: "{{ container_cli }}"
|
|
||||||
CONFIG: '/var/lib/container-puppet/{{ ansible_check_mode | bool | ternary("check-mode/", "") }}container-puppet.json'
|
|
||||||
CONFIG_VOLUME_PREFIX: '/var/lib/config-data{{ ansible_check_mode | bool | ternary("/check-mode", "") }}'
|
|
||||||
CHECK_MODE: '{{ ansible_check_mode | bool | ternary(1, 0) }}'
|
|
||||||
STARTUP_CONFIG_PATTERN: '/var/lib/tripleo-config/container-startup-config/*/{{ ansible_check_mode | bool | ternary("check-mode/", "") }}*.json'
|
|
||||||
MOUNT_HOST_PUPPET: '{{docker_puppet_mount_host_puppet | default(true)}}'
|
|
||||||
CONTAINER_LOG_STDOUT_PATH: "{{ container_log_stdout_path }}"
|
|
||||||
CONTAINER_HEALTHCHECK_DISABLED: "{{ container_healthcheck_disabled }}"
|
|
||||||
SHORT_HOSTNAME: "{{ ansible_hostname }}"
|
|
||||||
check_mode: no
|
|
||||||
register: generate_config_async_result
|
|
||||||
tags:
|
tags:
|
||||||
- container_config
|
- container_config
|
||||||
|
block:
|
||||||
|
- name: Run container-puppet tasks (generate config) during step 1 with paunch
|
||||||
|
async: 3600
|
||||||
|
poll: 0
|
||||||
|
shell: "{{ python_cmd }} /var/lib/container-puppet/container-puppet.py"
|
||||||
|
environment:
|
||||||
|
NET_HOST: 'true'
|
||||||
|
DEBUG: '{{ docker_puppet_debug | bool }}'
|
||||||
|
PROCESS_COUNT: "{{ docker_puppet_process_count }}"
|
||||||
|
CONTAINER_CLI: "{{ container_cli }}"
|
||||||
|
CONFIG: '/var/lib/container-puppet/{{ ansible_check_mode | bool | ternary("check-mode/", "") }}container-puppet.json'
|
||||||
|
CONFIG_VOLUME_PREFIX: '/var/lib/config-data{{ ansible_check_mode | bool | ternary("/check-mode", "") }}'
|
||||||
|
CHECK_MODE: '{{ ansible_check_mode | bool | ternary(1, 0) }}'
|
||||||
|
STARTUP_CONFIG_PATTERN: '/var/lib/tripleo-config/container-startup-config/*/{{ ansible_check_mode | bool | ternary("check-mode/", "") }}*.json'
|
||||||
|
MOUNT_HOST_PUPPET: '{{docker_puppet_mount_host_puppet | default(true)}}'
|
||||||
|
CONTAINER_LOG_STDOUT_PATH: "{{ container_log_stdout_path }}"
|
||||||
|
CONTAINER_HEALTHCHECK_DISABLED: "{{ container_healthcheck_disabled }}"
|
||||||
|
SHORT_HOSTNAME: "{{ ansible_hostname }}"
|
||||||
|
check_mode: no
|
||||||
|
register: generate_config_async_result
|
||||||
|
|
||||||
- name: Wait for container-puppet tasks (generate config) to finish
|
- name: Wait for container-puppet tasks (generate config) to finish
|
||||||
async_status:
|
async_status:
|
||||||
jid: "{{ generate_config_async_result.ansible_job_id }}"
|
jid: "{{ generate_config_async_result.ansible_job_id }}"
|
||||||
register: generate_config_outputs
|
register: generate_config_outputs
|
||||||
until: generate_config_outputs.finished
|
until: generate_config_outputs.finished
|
||||||
retries: 1200
|
retries: 1200
|
||||||
delay: 3
|
delay: 3
|
||||||
tags:
|
|
||||||
- container_config
|
|
||||||
|
|
||||||
- name: "Debug output for task: Run container-puppet tasks (generate config) during step 1"
|
- name: "Debug output for task: Run container-puppet tasks (generate config) during step 1"
|
||||||
debug:
|
debug:
|
||||||
var: generate_config_outputs.stdout_lines | default([]) | union(generate_config_outputs.stderr_lines | default([]))
|
var: generate_config_outputs.stdout_lines | default([]) | union(generate_config_outputs.stderr_lines | default([]))
|
||||||
when: generate_config_outputs.rc is defined
|
when: generate_config_outputs.rc is defined
|
||||||
failed_when: generate_config_outputs.rc != 0
|
failed_when: generate_config_outputs.rc != 0
|
||||||
|
ignore_errors: "{{ ansible_check_mode|bool }}"
|
||||||
|
|
||||||
|
- name: Block for container-puppet tasks (generate config) during step {{ step }} with tripleo-ansible
|
||||||
|
when:
|
||||||
|
- not enable_paunch|default(true)
|
||||||
tags:
|
tags:
|
||||||
- container_config
|
- container_config
|
||||||
ignore_errors: "{{ ansible_check_mode|bool }}"
|
block:
|
||||||
|
- name: Create base directory puppet configs
|
||||||
|
file:
|
||||||
|
path: "/var/lib/tripleo-config/container-puppet-config"
|
||||||
|
mode: 0700
|
||||||
|
recurse: true
|
||||||
|
setype: svirt_sandbox_file_t
|
||||||
|
|
||||||
|
- name: "Generate container puppet configs for step {{ step }}"
|
||||||
|
container_puppet_config:
|
||||||
|
check_mode: '{{ ansible_check_mode | bool | ternary(1, 0) }}'
|
||||||
|
config_vol_prefix: "/var/lib/config-data{{ ansible_check_mode | bool | ternary('/check-mode', '') }}"
|
||||||
|
debug: "{{ docker_puppet_debug | bool }}"
|
||||||
|
net_host: true
|
||||||
|
no_archive: false
|
||||||
|
puppet_config: "/var/lib/container-puppet/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}container-puppet.json"
|
||||||
|
short_hostname: "{{ ansible_hostname }}"
|
||||||
|
step: "{{ step }}"
|
||||||
|
|
||||||
|
- name: "Manage Puppet containers (generate config) for step {{ step }} with tripleo-ansible"
|
||||||
|
include_role:
|
||||||
|
name: tripleo_container_manage
|
||||||
|
vars:
|
||||||
|
tripleo_container_manage_concurrency: "{{ docker_puppet_process_count }}"
|
||||||
|
tripleo_container_manage_systemd_order: false
|
||||||
|
tripleo_container_manage_systemd_teardown: false
|
||||||
|
tripleo_container_manage_config: "/var/lib/tripleo-config/container-puppet-config/step_{{ step }}"
|
||||||
|
tripleo_container_manage_config_patterns: 'container-puppet-*.json'
|
||||||
|
tripleo_container_manage_config_id: "tripleo_puppet_step{{ step }}"
|
||||||
|
tripleo_container_manage_debug: "{{ docker_puppet_debug | bool }}"
|
||||||
|
# puppet with --detailed-exitcodes will return 0 for success and
|
||||||
|
# no changes and 2 for success and resource changes. Other
|
||||||
|
# numbers are failures
|
||||||
|
tripleo_container_manage_valid_exit_code: [0, 2]
|
||||||
|
|
||||||
- name: Diff container-puppet.py puppet-generated changes for check mode
|
- name: Diff container-puppet.py puppet-generated changes for check mode
|
||||||
shell: |
|
shell: |
|
||||||
|
|
|
@ -8,41 +8,74 @@
|
||||||
tags:
|
tags:
|
||||||
- container_config_tasks
|
- container_config_tasks
|
||||||
|
|
||||||
- name: Run container-puppet tasks (bootstrap tasks) for step {{ step }}
|
- name: Block for container-puppet tasks (bootstrap tasks) for step {{ step }} with paunch
|
||||||
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:
|
when:
|
||||||
- bootstrap_tasks_outputs.rc is defined
|
- enable_paunch|default(true)
|
||||||
failed_when: bootstrap_tasks_outputs.rc != 0
|
|
||||||
tags:
|
tags:
|
||||||
- container_config_tasks
|
- container_config_tasks
|
||||||
|
block:
|
||||||
|
- name: Run container-puppet tasks (bootstrap tasks) for step {{ step }} with paunch
|
||||||
|
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
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- name: Block for container-puppet tasks (bootstrap tasks) for step {{ step }} with tripleo-ansible
|
||||||
|
when:
|
||||||
|
- not enable_paunch|default(true)
|
||||||
|
tags:
|
||||||
|
- container_config_tasks
|
||||||
|
block:
|
||||||
|
- name: "Generate container puppet configs for step {{ step }}"
|
||||||
|
container_puppet_config:
|
||||||
|
check_mode: '{{ ansible_check_mode | bool | ternary(1, 0) }}'
|
||||||
|
config_vol_prefix: "/var/lib/config-data{{ ansible_check_mode | bool | ternary('/check-mode', '') }}"
|
||||||
|
debug: "{{ docker_puppet_debug | bool }}"
|
||||||
|
net_host: true
|
||||||
|
no_archive: true
|
||||||
|
puppet_config: "/var/lib/container-puppet/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}container-puppet-tasks{{ step }}.json"
|
||||||
|
short_hostname: "{{ ansible_hostname }}"
|
||||||
|
step: "{{ step }}"
|
||||||
|
|
||||||
|
- name: "Manage Puppet containers (bootstrap tasks) for step {{ step }} with tripleo-ansible"
|
||||||
|
include_role:
|
||||||
|
name: tripleo_container_manage
|
||||||
|
vars:
|
||||||
|
tripleo_container_manage_concurrency: "{{ docker_puppet_process_count }}"
|
||||||
|
tripleo_container_manage_systemd_order: false
|
||||||
|
tripleo_container_manage_systemd_teardown: false
|
||||||
|
tripleo_container_manage_config: "/var/lib/tripleo-config/container-puppet-config/step_{{ step }}"
|
||||||
|
tripleo_container_manage_config_patterns: 'container-puppet-*.json'
|
||||||
|
tripleo_container_manage_config_id: "tripleo_puppet_step{{ step }}"
|
||||||
|
tripleo_container_manage_debug: "{{ docker_puppet_debug | bool }}"
|
||||||
|
# puppet with --detailed-exitcodes will return 0 for success and
|
||||||
|
# no changes and 2 for success and resource changes. Other
|
||||||
|
# numbers are failures
|
||||||
|
tripleo_container_manage_valid_exit_code: [0, 2]
|
||||||
|
|
Loading…
Reference in New Issue