Browse Source

Drop unused remnants of the hosts-config bits

Hosts entries are used to be configured via tripleo_ansible's
tripleo_hosts_entries.

Ifd4bc4ce5618587c341ecbf37f82777ae6fc2f4a removed the use
of WRITE_HOSTS, which currently makes hosts-config.yaml "headless" and
taking no real data for the hosts-config.sh template that generates
outputs for OS::TripleO::Hosts::SoftwareConfig.

Also I606e0f27f9f9ae9d85bc0fc653f8985eb734d004 removed the use of
HOST_ENTRY, which makes the hosts-config.sh taking an empty value for
it.

Probably that all makes it safe now to remove any use of
hosts-config.sh and hosts-config.yaml and corresponding
OS::TripleO::Hosts::SoftwareConfig completely.

Change-Id: Id04767ae0c32caf62271cf564608350974fefd1b
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
changes/88/714588/2
Bogdan Dobrelya 2 years ago
parent
commit
341ec7b9cc
  1. 1
      common/deploy-steps.j2
  2. 38
      hosts-config.yaml
  3. 1
      overcloud-resource-registry-puppet.j2.yaml
  4. 47
      scripts/hosts-config.sh

1
common/deploy-steps.j2

@ -404,7 +404,6 @@ outputs:
container_puppet_script: {get_file: ./container-puppet.sh}
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}
generate-config-tasks: {get_file: generate-config-tasks.yaml}
host-container-puppet-tasks: {get_file: host-container-puppet-tasks.yaml}
deploy_steps_playbook:

38
hosts-config.yaml

@ -1,38 +0,0 @@
heat_template_version: rocky
description: 'All Hosts Config'
parameters:
hosts:
type: string
resources:
hostsConfigImpl:
type: OS::Heat::SoftwareConfig
properties:
group: script
config:
str_replace:
params:
WRITE_HOSTS:
list_join:
- ' '
- str_split:
- '\n'
- {get_param: hosts}
template: {get_file: scripts/hosts-config.sh}
outputs:
config_id:
description: The ID of the hostsConfigImpl resource.
value:
{get_resource: hostsConfigImpl}
hosts_entries:
description: |
The content that should be appended to your /etc/hosts if you want to get
hostname-based access to the deployed nodes (useful for testing without
setting up a DNS).
value: {get_param: hosts}
OS::stack_id:
description: The ID of the hostsConfigImpl resource.
value: {get_resource: hostsConfigImpl}

1
overcloud-resource-registry-puppet.j2.yaml

@ -5,7 +5,6 @@ resource_registry:
OS::Heat::StructuredDeployment: config-download-structured.yaml
OS::TripleO::PostDeploySteps: common/post.yaml
OS::TripleO::AllNodesDeployment: OS::Heat::None
OS::TripleO::Hosts::SoftwareConfig: hosts-config.yaml
OS::TripleO::DefaultPasswords: default_passwords.yaml
OS::TripleO::RandomString: OS::Heat::RandomString

47
scripts/hosts-config.sh

@ -1,47 +0,0 @@
#!/bin/bash
set -eux
set -o pipefail
write_entries() {
local file="$1"
local entries="$2"
# Don't do anything if the file isn't there
if [ ! -f "$file" ]; then
return
fi
if grep -q "^# HEAT_HOSTS_START" "$file"; then
temp=$(mktemp)
(
sed '/^# HEAT_HOSTS_START/,$d' "$file"
echo -ne "\n# HEAT_HOSTS_START - Do not edit manually within this section!\n"
echo "$entries"
echo -ne "# HEAT_HOSTS_END\n\n"
sed '1,/^# HEAT_HOSTS_END/d' "$file"
) > "$temp"
echo "INFO: Updating hosts file $file, check below for changes"
diff "$file" "$temp" || true
cat "$temp" > "$file"
else
# NOTE(aschultz): we purge any entries in the hosts file that match
# the existing short hostname on initial installation only. This
# prevents existing data from coming through and causing deployment
# issues when services (I'm looking at you rabbitmq) start up.
sed -i "/$(hostname -s)/d" "$file"
echo -ne "\n# HEAT_HOSTS_START - Do not edit manually within this section!\n" >> "$file"
echo "$entries" >> "$file"
echo -ne "# HEAT_HOSTS_END\n\n" >> "$file"
fi
}
hosts="$HOSTS_ENTRY"
if [ ! -z "$hosts" ]; then
for tmpl in /etc/cloud/templates/hosts.*.tmpl ; do
write_entries "$tmpl" "$hosts"
done
write_entries "/etc/hosts" "$hosts"
else
echo "No hosts in Heat, nothing written."
fi
Loading…
Cancel
Save