Use ansible for HostsConfig

Replace the HostsConfig SoftwareDeployment with an ansible task.

implements: blueprint reduce-deployment-resources
Change-Id: Ifd4bc4ce5618587c341ecbf37f82777ae6fc2f4a
This commit is contained in:
James Slagle 2019-06-07 10:19:43 -04:00 committed by Emilien Macchi
parent cff9911abe
commit 79d9113e5d
3 changed files with 27 additions and 17 deletions

View File

@ -152,6 +152,10 @@ parameters:
description: A list of HTTP URLs containing deployment artifacts. description: A list of HTTP URLs containing deployment artifacts.
Currently supports tarballs and RPM packages. Currently supports tarballs and RPM packages.
type: comma_delimited_list type: comma_delimited_list
HostsEntry:
default: ''
type: string
description: A string of entries to be added to /etc/hosts on each node.
conditions: conditions:
{% for role in enabled_roles %} {% for role in enabled_roles %}
@ -284,10 +288,12 @@ outputs:
ping_test_ips: {get_param: PingTestIpsMap} ping_test_ips: {get_param: PingTestIpsMap}
stack_action: {get_param: StackAction} stack_action: {get_param: StackAction}
deploy_artifact_urls: {list_join: [' ', {get_param: DeployArtifactURLs}]} deploy_artifact_urls: {list_join: [' ', {get_param: DeployArtifactURLs}]}
hosts_entry: {get_param: HostsEntry}
common_deploy_steps_tasks: {get_file: deploy-steps-tasks.yaml} common_deploy_steps_tasks: {get_file: deploy-steps-tasks.yaml}
docker_puppet_script: {get_file: ./container-puppet.py} docker_puppet_script: {get_file: ./container-puppet.py}
all_nodes_validation_script.sh : {get_file: ../validation-scripts/all-nodes.sh} all_nodes_validation_script.sh : {get_file: ../validation-scripts/all-nodes.sh}
deploy-artifacts.sh : {get_file: ../puppet/deploy-artifacts.sh} deploy-artifacts.sh : {get_file: ../puppet/deploy-artifacts.sh}
hosts-config.sh: {get_file: ../scripts/hosts-config.sh}
deploy_steps_playbook: deploy_steps_playbook:
str_replace: str_replace:
params: params:
@ -479,6 +485,11 @@ outputs:
environment: environment:
artifact_urls: {{ '"{{' }} deploy_artifact_urls {{ '}}"' }} artifact_urls: {{ '"{{' }} deploy_artifact_urls {{ '}}"' }}
- name: HostsConfig
script: hosts-config.sh
environment:
HOSTS_ENTRY: {{ '"{{' }} hosts_entry {{ '}}"' }}
tags: tags:
- overcloud - overcloud
- pre_deploy_steps - pre_deploy_steps

View File

@ -570,13 +570,6 @@ resources:
- keystone_admin_api - keystone_admin_api
- keystone_public_api - keystone_public_api
{{role.name}}HostsDeployment:
type: OS::Heat::StructuredDeployments
properties:
name: {{role.name}}HostsDeployment
config: {get_attr: [hostsConfig, config_id]}
servers: {get_attr: [{{role.name}}Servers, value]}
{{role.name}}SshKnownHostsDeployment: {{role.name}}SshKnownHostsDeployment:
type: OS::TripleO::Ssh::KnownHostsDeployment type: OS::TripleO::Ssh::KnownHostsDeployment
properties: properties:
@ -588,7 +581,6 @@ resources:
type: OS::TripleO::AllNodesDeployment type: OS::TripleO::AllNodesDeployment
depends_on: depends_on:
{%- for role_inner in roles %} {%- for role_inner in roles %}
- {{role_inner.name}}HostsDeployment
- {{role_inner.name}}SshKnownHostsDeployment - {{role_inner.name}}SshKnownHostsDeployment
{%- endfor %} {%- endfor %}
properties: properties:
@ -732,10 +724,10 @@ resources:
for_each: for_each:
hostname: {get_param: DeploymentServerBlacklist} hostname: {get_param: DeploymentServerBlacklist}
hostsConfig: HostsValue:
type: OS::TripleO::Hosts::SoftwareConfig type: OS::Heat::Value
properties: properties:
hosts: value:
list_join: list_join:
- "\n" - "\n"
- - if: - - if:
@ -750,6 +742,16 @@ resources:
{%- endfor %} {%- endfor %}
- {get_param: ExtraHostFileEntries} - {get_param: ExtraHostFileEntries}
HostsEntryValue:
type: OS::Heat::Value
properties:
value:
list_join:
- ' '
- str_split:
- '\n'
- {get_attr: [HostsValue, value]}
{%- for outer_role in roles %} {%- for outer_role in roles %}
{{outer_role.name}}allNodesConfig: {{outer_role.name}}allNodesConfig:
type: OS::TripleO::AllNodes::SoftwareConfig type: OS::TripleO::AllNodes::SoftwareConfig
@ -962,10 +964,6 @@ resources:
# the nested template may configure each role differently (or not at all) # the nested template may configure each role differently (or not at all)
AllNodesExtraConfig: AllNodesExtraConfig:
type: OS::TripleO::AllNodesExtraConfig type: OS::TripleO::AllNodesExtraConfig
depends_on:
{%- for role in roles %}
- {{role.name}}HostsDeployment
{%- endfor %}
properties: properties:
servers: servers:
{%- for role in roles %} {%- for role in roles %}
@ -1033,6 +1031,7 @@ resources:
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{%- endfor %} {%- endfor %}
HostsEntry: {get_attr: [HostsEntryValue, value]}
ServerOsCollectConfigData: ServerOsCollectConfigData:
type: OS::Heat::Value type: OS::Heat::Value
@ -1104,7 +1103,7 @@ outputs:
value: value:
list_join: list_join:
- "\n" - "\n"
- - {get_attr: [hostsConfig, hosts_entries]} - - {get_attr: [HostsEntryValue, value]}
- - {get_attr: [VipHosts, value]} - - {get_attr: [VipHosts, value]}
EnabledServices: EnabledServices:
description: The services enabled on each role description: The services enabled on each role

View File

@ -36,7 +36,7 @@ write_entries() {
} }
hosts="WRITE_HOSTS" hosts="$HOSTS_ENTRY"
if [ ! -z "$hosts" ]; then if [ ! -z "$hosts" ]; then
for tmpl in /etc/cloud/templates/hosts.*.tmpl ; do for tmpl in /etc/cloud/templates/hosts.*.tmpl ; do
write_entries "$tmpl" "$hosts" write_entries "$tmpl" "$hosts"