From 841c18e7ebc52f2b0e03537f4e16541e49249517 Mon Sep 17 00:00:00 2001 From: Andrey Shestakov Date: Wed, 7 Dec 2016 15:43:58 +0200 Subject: [PATCH] Fix issue with /etc/hosts in ansible element Ansible require valid hostname in /etc/hosts file. This file does not exists in ubuntu-minimal Xenial, which causes build fail. This change ensures that /etc/hosts file exists and has required content. This change requires dib > 1.25.2 (or current master branch). Also, move openssh-server from package-installs to element-deps, as there is a separate element for that. Change-Id: I5ff78cf6591ef2228a3695d91d8b2c2095fc28b3 --- imagebuild/ironic-ansible/element-deps | 1 + imagebuild/ironic-ansible/package-installs.yaml | 1 - .../post-install.d/{81-ansible-ssh => 81-ansible-host} | 8 +------- 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 imagebuild/ironic-ansible/package-installs.yaml rename imagebuild/ironic-ansible/post-install.d/{81-ansible-ssh => 81-ansible-host} (60%) diff --git a/imagebuild/ironic-ansible/element-deps b/imagebuild/ironic-ansible/element-deps index a3ed5fd..41a6f9d 100644 --- a/imagebuild/ironic-ansible/element-deps +++ b/imagebuild/ironic-ansible/element-deps @@ -1,2 +1,3 @@ ironic-agent devuser +openssh-server diff --git a/imagebuild/ironic-ansible/package-installs.yaml b/imagebuild/ironic-ansible/package-installs.yaml deleted file mode 100644 index c342a0b..0000000 --- a/imagebuild/ironic-ansible/package-installs.yaml +++ /dev/null @@ -1 +0,0 @@ -openssh-server: diff --git a/imagebuild/ironic-ansible/post-install.d/81-ansible-ssh b/imagebuild/ironic-ansible/post-install.d/81-ansible-host similarity index 60% rename from imagebuild/ironic-ansible/post-install.d/81-ansible-ssh rename to imagebuild/ironic-ansible/post-install.d/81-ansible-host index 0889480..9977e95 100755 --- a/imagebuild/ironic-ansible/post-install.d/81-ansible-ssh +++ b/imagebuild/ironic-ansible/post-install.d/81-ansible-host @@ -20,10 +20,4 @@ echo $ANSIBLE_DEPLOY_HOSTAME > /etc/hostname # Ansible issues #13965 (fixed in 2.0.1.0), #14568, #14714 # ensure /etc/hosts has hostname in it -sed -i "s/127.0.0.1\s*localhost/127.0.0.1 localhost $ANSIBLE_DEPLOY_HOSTAME/g" /etc/hosts - -# ensure SSH host keys exist -ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa -ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa -ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa -ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519 +echo "127.0.0.1 $ANSIBLE_DEPLOY_HOSTAME" >> /etc/hosts