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

View File

@ -570,13 +570,6 @@ resources:
- keystone_admin_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:
type: OS::TripleO::Ssh::KnownHostsDeployment
properties:
@ -588,7 +581,6 @@ resources:
type: OS::TripleO::AllNodesDeployment
depends_on:
{%- for role_inner in roles %}
- {{role_inner.name}}HostsDeployment
- {{role_inner.name}}SshKnownHostsDeployment
{%- endfor %}
properties:
@ -732,10 +724,10 @@ resources:
for_each:
hostname: {get_param: DeploymentServerBlacklist}
hostsConfig:
type: OS::TripleO::Hosts::SoftwareConfig
HostsValue:
type: OS::Heat::Value
properties:
hosts:
value:
list_join:
- "\n"
- - if:
@ -750,6 +742,16 @@ resources:
{%- endfor %}
- {get_param: ExtraHostFileEntries}
HostsEntryValue:
type: OS::Heat::Value
properties:
value:
list_join:
- ' '
- str_split:
- '\n'
- {get_attr: [HostsValue, value]}
{%- for outer_role in roles %}
{{outer_role.name}}allNodesConfig:
type: OS::TripleO::AllNodes::SoftwareConfig
@ -962,10 +964,6 @@ resources:
# the nested template may configure each role differently (or not at all)
AllNodesExtraConfig:
type: OS::TripleO::AllNodesExtraConfig
depends_on:
{%- for role in roles %}
- {{role.name}}HostsDeployment
{%- endfor %}
properties:
servers:
{%- for role in roles %}
@ -1033,6 +1031,7 @@ resources:
{%- endif %}
{%- endfor %}
{%- endfor %}
HostsEntry: {get_attr: [HostsEntryValue, value]}
ServerOsCollectConfigData:
type: OS::Heat::Value
@ -1104,7 +1103,7 @@ outputs:
value:
list_join:
- "\n"
- - {get_attr: [hostsConfig, hosts_entries]}
- - {get_attr: [HostsEntryValue, value]}
- - {get_attr: [VipHosts, value]}
EnabledServices:
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
for tmpl in /etc/cloud/templates/hosts.*.tmpl ; do
write_entries "$tmpl" "$hosts"