Evaluating ansible_check_mode as a boolean
Evaluating ansible_check_mode as a bare variable is deprecated in
Ansible 2.8 and its support will be removed in 2.12.
Change-Id: I4d566bf8b7b3085d693fe94b53384e667f81b092
(cherry picked from commit 7e73fac11a
)
This commit is contained in:
parent
c630f13fd0
commit
d4218d1f39
@ -68,7 +68,7 @@
|
||||
- container_config_scripts
|
||||
- container_startup_configs
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
ignore_errors: true
|
||||
check_mode: no
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
- container_config_scripts
|
||||
- container_startup_configs
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
check_mode: no
|
||||
|
||||
# Puppet manifest for baremetal host configuration
|
||||
@ -94,7 +94,7 @@
|
||||
no_log: True
|
||||
copy:
|
||||
content: "{{ lookup('file', tripleo_role_name + '/step_config.pp', errors='ignore') | default('', True) }}"
|
||||
dest: /var/lib/tripleo-config/{{ ansible_check_mode | ternary('check-mode/', '') }}puppet_step_config.pp
|
||||
dest: /var/lib/tripleo-config/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}puppet_step_config.pp
|
||||
force: yes
|
||||
mode: '0600'
|
||||
tags:
|
||||
@ -110,7 +110,7 @@
|
||||
- host_config
|
||||
check_mode: no
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
- ansible_diff_mode
|
||||
failed_when: false
|
||||
changed_when: diff_results.rc == 1
|
||||
@ -120,7 +120,7 @@
|
||||
var: diff_results.stdout_lines
|
||||
changed_when: diff_results.rc == 1
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
- ansible_diff_mode
|
||||
tags:
|
||||
- host_config
|
||||
@ -172,7 +172,7 @@
|
||||
ignore_errors: true
|
||||
check_mode: no
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
|
||||
- name: Create /var/lib/container-puppet/check-mode for check mode
|
||||
file:
|
||||
@ -184,13 +184,13 @@
|
||||
- container_config
|
||||
check_mode: no
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
|
||||
- name: Write container-puppet.json file
|
||||
no_log: True
|
||||
copy:
|
||||
content: "{{ lookup('file', tripleo_role_name + '/puppet_config.yaml', errors='ignore') | default([], True) | from_yaml | to_nice_json }}"
|
||||
dest: /var/lib/container-puppet/{{ ansible_check_mode | ternary('check-mode/', '') }}container-puppet.json
|
||||
dest: /var/lib/container-puppet/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}container-puppet.json
|
||||
force: yes
|
||||
mode: '0600'
|
||||
tags:
|
||||
@ -206,7 +206,7 @@
|
||||
- container_config
|
||||
check_mode: no
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
- ansible_diff_mode
|
||||
failed_when: false
|
||||
changed_when: diff_results.rc == 1
|
||||
@ -216,7 +216,7 @@
|
||||
var: diff_results.stdout_lines
|
||||
changed_when: diff_results.rc == 1
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
- ansible_diff_mode
|
||||
tags:
|
||||
- container_config
|
||||
@ -345,7 +345,7 @@
|
||||
stat:
|
||||
path: /etc/puppet/check-mode
|
||||
register: check_mode_dir
|
||||
when: ansible_check_mode
|
||||
when: ansible_check_mode|bool
|
||||
tags:
|
||||
- host_config
|
||||
- container_config
|
||||
@ -359,7 +359,7 @@
|
||||
recurse: true
|
||||
check_mode: no
|
||||
when:
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
- not check_mode_dir.stat.exists
|
||||
tags:
|
||||
- host_config
|
||||
@ -369,7 +369,7 @@
|
||||
no_log: True
|
||||
copy:
|
||||
content: "{{ dict(step=step|int) | to_json }}"
|
||||
dest: /etc/puppet/{{ ansible_check_mode | ternary('check-mode/', '') }}hieradata/config_step.json
|
||||
dest: /etc/puppet/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}hieradata/config_step.json
|
||||
force: true
|
||||
mode: '0600'
|
||||
check_mode: no
|
||||
@ -382,7 +382,7 @@
|
||||
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
|
||||
- ansible_check_mode|bool
|
||||
- not check_mode_dir.stat.exists
|
||||
check_mode: no
|
||||
tags:
|
||||
@ -397,9 +397,9 @@
|
||||
--detailed-exitcodes
|
||||
--summarize
|
||||
--logdest syslog --logdest console --color=false
|
||||
{{ ansible_check_mode | ternary('--noop', '') }}
|
||||
{{ ansible_check_mode | ternary('--hiera_config /etc/puppet/check-mode/hiera.yaml', '') }}
|
||||
/var/lib/tripleo-config/{{ ansible_check_mode | ternary('check-mode/', '') }}puppet_step_config.pp
|
||||
{{ ansible_check_mode | bool | ternary('--noop', '') }}
|
||||
{{ ansible_check_mode | bool | ternary('--hiera_config /etc/puppet/check-mode/hiera.yaml', '') }}
|
||||
/var/lib/tripleo-config/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}puppet_step_config.pp
|
||||
changed_when: outputs.rc == 2
|
||||
register: outputs
|
||||
failed_when: false
|
||||
@ -417,7 +417,7 @@
|
||||
failed_when: outputs.rc not in [0, 2]
|
||||
tags:
|
||||
- host_config
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
ignore_errors: "{{ ansible_check_mode|bool }}"
|
||||
|
||||
######################################
|
||||
# Generate config via container-puppet.py
|
||||
@ -430,10 +430,10 @@
|
||||
DEBUG: '{{ docker_puppet_debug | bool }}'
|
||||
PROCESS_COUNT: '{{ docker_puppet_process_count }}'
|
||||
CONTAINER_CLI: "{{ container_cli }}"
|
||||
CONFIG: '/var/lib/container-puppet/{{ ansible_check_mode | ternary("check-mode/", "") }}container-puppet.json'
|
||||
CONFIG_VOLUME_PREFIX: '/var/lib/config-data{{ ansible_check_mode | ternary("/check-mode", "") }}'
|
||||
CHECK_MODE: '{{ ansible_check_mode | ternary(1, 0) }}'
|
||||
STARTUP_CONFIG_PATTERN: '/var/lib/tripleo-config/{{ ansible_check_mode | ternary("check-mode/", "") }}container-startup-config-step_*.json'
|
||||
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/{{ ansible_check_mode | bool | ternary("check-mode/", "") }}container-startup-config-step_*.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 }}"
|
||||
@ -453,7 +453,7 @@
|
||||
failed_when: outputs.rc != 0
|
||||
tags:
|
||||
- container_config
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
ignore_errors: "{{ ansible_check_mode|bool }}"
|
||||
|
||||
- name: Diff container-puppet.py puppet-generated changes for check mode
|
||||
shell: |
|
||||
@ -465,7 +465,7 @@
|
||||
check_mode: no
|
||||
when:
|
||||
- step == "1"
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
- ansible_diff_mode
|
||||
failed_when: false
|
||||
changed_when: diff_results.rc == 1
|
||||
@ -476,7 +476,7 @@
|
||||
changed_when: diff_results.rc == 1
|
||||
when:
|
||||
- step == "1"
|
||||
- ansible_check_mode
|
||||
- ansible_check_mode|bool
|
||||
- ansible_diff_mode
|
||||
tags:
|
||||
- container_config
|
||||
@ -548,8 +548,8 @@
|
||||
- name: Run container-puppet tasks (bootstrap tasks) for step {{ step }}
|
||||
shell: "{{ python_cmd }} /var/lib/container-puppet/container-puppet.py"
|
||||
environment:
|
||||
CONFIG: /var/lib/container-puppet/{{ ansible_check_mode | ternary('check-mode/', '') }}container-puppet-tasks{{ step }}.json
|
||||
CONFIG_VOLUME_PREFIX: '/var/lib/config-data{{ ansible_check_mode | ternary("/check-mode", "") }}'
|
||||
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 }}"
|
||||
|
@ -590,7 +590,7 @@ outputs:
|
||||
src: /var/log/swift
|
||||
dest: /var/log/containers/swift
|
||||
state: link
|
||||
ignore_errors: "{{ ansible_check_mode }}"
|
||||
ignore_errors: "{{ ansible_check_mode|bool }}"
|
||||
when: swift_log_stat.stat.exists
|
||||
- name: swift logs readme
|
||||
copy:
|
||||
|
Loading…
Reference in New Issue
Block a user