Browse Source

deploy-steps: switch to tripleo_role_name

"role_name" is internal to Ansible, we should not use it.
This patch uses the new variable set in the inventory to use a specific
TripleO var: tripleo_role_name which is the TripleO role name and not
the Ansible role names, both things are very different.

Depends-On: I57c4eac87e2f96dfe5490b111cd2508505715d56
Change-Id: Iecaf6f1b830e65be2f9e2e44431054fe46f9f565
Related-Bug: #1771171
(cherry picked from commit 1bec01137e)
changes/28/582428/1
Emilien Macchi 3 years ago
committed by James Slagle
parent
commit
7af622b117
  1. 26
      common/deploy-steps-tasks.yaml
  2. 30
      common/deploy-steps.j2

26
common/deploy-steps-tasks.yaml

@ -16,13 +16,13 @@
delegate_to: localhost
become: false
stat:
path: "{{ role_name + '/step_config.pp' }}"
path: "{{ tripleo_role_name + '/step_config.pp' }}"
register: stat_step_config
- name: Set fact when file existed
no_log: True
set_fact:
role_data_step_config: "{{lookup('file', role_name + '/step_config.pp')}}"
role_data_step_config: "{{lookup('file', tripleo_role_name + '/step_config.pp')}}"
when: stat_step_config.stat.exists
- name: Write the puppet step_config manifest
@ -36,13 +36,13 @@
delegate_to: localhost
become: false
stat:
path: "{{ role_name + '/puppet_config.yaml' }}"
path: "{{ tripleo_role_name + '/puppet_config.yaml' }}"
register: stat_puppet_config
- name: Set fact when file existed
no_log: True
set_fact:
role_data_puppet_config: "{{lookup('file', role_name + '/puppet_config.yaml') | from_yaml | to_json}}"
role_data_puppet_config: "{{lookup('file', tripleo_role_name + '/puppet_config.yaml') | from_yaml | to_json}}"
when: stat_puppet_config.stat.exists
- name: Write docker-puppet.json file
@ -63,13 +63,13 @@
delegate_to: localhost
become: false
stat:
path: "{{ role_name + '/docker_config_scripts.yaml' }}"
path: "{{ tripleo_role_name + '/docker_config_scripts.yaml' }}"
register: stat_docker_config_scripts
- name: Set fact when file existed
no_log: True
set_fact:
role_data_docker_config_scripts: "{{lookup('file', role_name + '/docker_config_scripts.yaml') | from_yaml}}"
role_data_docker_config_scripts: "{{lookup('file', tripleo_role_name + '/docker_config_scripts.yaml') | from_yaml}}"
when: stat_docker_config_scripts.stat.exists
- name: Write docker config scripts
@ -91,13 +91,13 @@
delegate_to: localhost
become: false
stat:
path: "{{ role_name + '/docker_config.yaml' }}"
path: "{{ tripleo_role_name + '/docker_config.yaml' }}"
register: stat_docker_config
- name: Set fact when file existed
no_log: True
set_fact:
role_data_docker_config: "{{lookup('file', role_name + '/docker_config.yaml') | from_yaml}}"
role_data_docker_config: "{{lookup('file', tripleo_role_name + '/docker_config.yaml') | from_yaml}}"
when: stat_docker_config.stat.exists
- name: Set docker_startup_configs_with_default fact
@ -119,13 +119,13 @@
delegate_to: localhost
become: false
stat:
path: "{{ role_name + '/kolla_config.yaml' }}"
path: "{{ tripleo_role_name + '/kolla_config.yaml' }}"
register: stat_kolla_config
- name: Set fact when file existed
no_log: True
set_fact:
role_data_kolla_config: "{{lookup('file', role_name + '/kolla_config.yaml') | from_yaml}}"
role_data_kolla_config: "{{lookup('file', tripleo_role_name + '/kolla_config.yaml') | from_yaml}}"
when: stat_kolla_config.stat.exists
- name: Write kolla config json files
@ -148,13 +148,13 @@
delegate_to: localhost
become: false
stat:
path: "{{ role_name + '/docker_puppet_tasks.yaml' }}"
path: "{{ tripleo_role_name + '/docker_puppet_tasks.yaml' }}"
register: stat_docker_puppet_tasks
- name: Set fact when file existed
no_log: True
set_fact:
role_data_docker_puppet_tasks: "{{lookup('file', role_name + '/docker_puppet_tasks.yaml') | from_yaml}}"
role_data_docker_puppet_tasks: "{{lookup('file', tripleo_role_name + '/docker_puppet_tasks.yaml') | from_yaml}}"
when: stat_docker_puppet_tasks.stat.exists
- name: Write docker-puppet-tasks json files
@ -229,7 +229,7 @@
command: >-
paunch --debug apply
--file /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
--config-id tripleo_step{{step}} --managed-by tripleo-{{role_name}}
--config-id tripleo_step{{step}} --managed-by tripleo-{{tripleo_role_name}}
changed_when: false
check_mode: no
register: outputs

30
common/deploy-steps.j2

@ -106,7 +106,7 @@ resources:
modulepath: /usr/share/ansible-modules
inputs:
- name: step
- name: role_name
- name: tripleo_role_name
- name: update_identifier
- name: bootstrap_server_id
- name: enable_debug
@ -326,7 +326,7 @@ resources:
config: {get_resource: RoleConfig}
input_values:
step: {{step}}
role_name: {{role.name}}
tripleo_role_name: {{role.name}}
update_identifier: {get_param: DeployIdentifier}
bootstrap_server_id: {get_attr: [BootstrapServerId, value]}
enable_debug: {get_param: ConfigDebug}
@ -426,7 +426,7 @@ outputs:
- include: {{role.name}}/deployments.yaml
vars:
force: false
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
with_items: "{{ '{{' }} {{role.name}}_pre_deployments|default([]) {{ '}}' }}"
{%- endfor %}
tags:
@ -443,7 +443,7 @@ outputs:
tasks:
{%- for role in roles %}
- include: {{role.name}}/host_prep_tasks.yaml
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
tags:
- overcloud
@ -477,7 +477,7 @@ outputs:
tasks:
{%- for role in roles %}
- include: {{role.name}}/deploy_steps_tasks.yaml
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
tags:
- overcloud
@ -506,7 +506,7 @@ outputs:
- include: {{role.name}}/deployments.yaml
vars:
force: false
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
with_items: "{{ '{{' }} {{role.name}}_post_deployments|default([]) {{ '}}' }}"
{%- endfor %}
tags:
@ -529,7 +529,7 @@ outputs:
update_steps_tasks: |
{%- for role in roles %}
- include: {{role.name}}/update_tasks.yaml
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
update_steps_playbook: |
- hosts: undercloud
@ -568,7 +568,7 @@ outputs:
pre_upgrade_rolling_steps_tasks: |
{%- for role in roles %}
- include: {{role.name}}/pre_upgrade_rolling_tasks.yaml
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
pre_upgrade_rolling_steps_playbook: |
- hosts: undercloud
@ -595,7 +595,7 @@ outputs:
upgrade_steps_tasks: |
{%- for role in roles %}
- include: {{role.name}}/upgrade_tasks.yaml
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
upgrade_steps_playbook: |
- hosts: overcloud
@ -607,7 +607,7 @@ outputs:
post_upgrade_steps_tasks: |
{%- for role in roles %}
- include: {{role.name}}/post_upgrade_tasks.yaml
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
post_upgrade_steps_playbook: |
- hosts: overcloud
@ -650,7 +650,7 @@ outputs:
rm -f /usr/libexec/os-apply-config/templates/etc/puppet/hiera.yaml
rm -f /usr/libexec/os-refresh-config/configure.d/10-hiera-disable
fi
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
name: Run Fast Forward Upgrade Prep Workarounds for {{role.name}}
{%- endfor %}
{% raw %}
@ -675,7 +675,7 @@ outputs:
fast_forward_upgrade_post_role_tasks: |
{%- for role in roles %}
- include_tasks: {{role.name}}/fast_forward_post_upgrade_tasks.yaml
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
- name: Openstack Heat Agents package update
yum: name=openstack-heat-agents state=latest
@ -686,7 +686,7 @@ outputs:
fast_forward_upgrade_prep_role_tasks: |
{%- for role in roles %}
- include_tasks: {{role.name}}/fast_forward_upgrade_tasks.yaml
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
fast_forward_upgrade_bootstrap_tasks: |
- include_tasks: fast_forward_upgrade_bootstrap_role_tasks.yaml
@ -696,10 +696,10 @@ outputs:
fast_forward_upgrade_bootstrap_role_tasks: |
{%- for role in roles %}
- include_tasks: {{role.name}}/fast_forward_upgrade_tasks.yaml
when: role_name == '{{role.name}}' and ansible_hostname == {{role.name}}[0]
when: tripleo_role_name == '{{role.name}}' and ansible_hostname == {{role.name}}[0]
{%- endfor %}
post_update_steps_tasks: |
{%- for role in roles %}
- include: {{role.name}}/post_update_tasks.yaml
when: role_name == '{{role.name}}'
when: tripleo_role_name == '{{role.name}}'
{%- endfor %}
Loading…
Cancel
Save