Merge "Use str_replace for known_hosts"
This commit is contained in:
@@ -11,26 +11,32 @@ resources:
|
|||||||
type: OS::Heat::SoftwareConfig
|
type: OS::Heat::SoftwareConfig
|
||||||
properties:
|
properties:
|
||||||
group: script
|
group: script
|
||||||
inputs:
|
|
||||||
- name: known_hosts
|
|
||||||
default: {get_param: known_hosts}
|
|
||||||
config: |
|
config: |
|
||||||
#!/bin/bash
|
str_replace:
|
||||||
set -eux
|
params:
|
||||||
set -o pipefail
|
KNOWN_HOSTS: {get_param: known_hosts}
|
||||||
|
template: |
|
||||||
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
echo "Creating ssh known hosts file"
|
echo "Creating ssh known hosts file"
|
||||||
|
|
||||||
if [ ! -z "${known_hosts}" ]; then
|
if [ -d /etc/ssh/ssh_known_hosts ]; then
|
||||||
echo "${known_hosts}"
|
rm -rf /etc/ssh/ssh_known_hosts
|
||||||
echo -ne "${known_hosts}" > /etc/ssh/ssh_known_hosts
|
fi
|
||||||
chmod 0644 /etc/ssh/ssh_known_hosts
|
cat <<EOF | grep -v '^$' >/etc/ssh/ssh_known_hosts
|
||||||
else
|
KNOWN_HOSTS
|
||||||
rm -f /etc/ssh/ssh_known_hosts
|
EOF
|
||||||
echo "No ssh known hosts"
|
if [ ! -s /etc/ssh/ssh_known_hosts ]; then
|
||||||
fi
|
echo "No known hosts"
|
||||||
|
rm -f /etc/ssh/ssh_known_hosts
|
||||||
|
else
|
||||||
|
echo "$(cat /etc/ssh/ssh_known_hosts | wc -l) known hosts"
|
||||||
|
chmod 0644 /etc/ssh/ssh_known_hosts
|
||||||
|
fi
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
OS::stack_id:
|
OS::stack_id:
|
||||||
description: The SSHKnownHostsConfig resource.
|
description: The SSHKnownHostsConfig resource.
|
||||||
value: {get_resource: SSHKnownHostsConfig}
|
value: {get_resource: SSHKnownHostsConfig}
|
||||||
|
@@ -488,6 +488,7 @@ resources:
|
|||||||
depends_on:
|
depends_on:
|
||||||
{% for role_inner in roles %}
|
{% for role_inner in roles %}
|
||||||
- {{role_inner.name}}HostsDeployment
|
- {{role_inner.name}}HostsDeployment
|
||||||
|
- {{role_inner.name}}SshKnownHostsDeployment
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
properties:
|
properties:
|
||||||
name: {{role.name}}AllNodesDeployment
|
name: {{role.name}}AllNodesDeployment
|
||||||
|
Reference in New Issue
Block a user