From 1bec01137eca33fa210daa044571629b6ff848b8 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Mon, 14 May 2018 11:15:09 -0700 Subject: [PATCH] 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 --- common/deploy-steps-tasks.yaml | 26 +++++++++++++------------- common/deploy-steps.j2 | 32 ++++++++++++++++---------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/common/deploy-steps-tasks.yaml b/common/deploy-steps-tasks.yaml index 82777e224c..160cff1a8c 100644 --- a/common/deploy-steps-tasks.yaml +++ b/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 @@ -234,7 +234,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 diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index 11366a0518..c47f2718e2 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -107,7 +107,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 @@ -322,7 +322,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} @@ -424,7 +424,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 @@ -438,7 +438,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: @@ -455,7 +455,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 @@ -489,7 +489,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 @@ -518,7 +518,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: @@ -541,7 +541,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 @@ -572,7 +572,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 @@ -599,7 +599,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 @@ -611,7 +611,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 @@ -654,7 +654,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 %} @@ -679,7 +679,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 @@ -690,7 +690,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 @@ -700,12 +700,12 @@ 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 %} post_update_steps_playbook: | - hosts: overcloud