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
This commit is contained in:
Andrey Shestakov 2016-12-07 15:43:58 +02:00 committed by Pavlo Shchelokovskyy
parent b20420ea4e
commit 841c18e7eb
3 changed files with 2 additions and 8 deletions

View File

@ -1,2 +1,3 @@
ironic-agent
devuser
openssh-server

View File

@ -1 +0,0 @@
openssh-server:

View File

@ -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