Create hosts file for ansible-playbook

Be explicity with our inventory file, to avoid ansible-playbook from
skipping hosts.

Change-Id: I29260bd97432a443e5989fa4a883e8e8d37307fd
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-04-18 13:15:05 -04:00
parent 7be50ec892
commit e72ed2fe58
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
1 changed files with 4 additions and 1 deletions

View File

@ -22,10 +22,13 @@ cat > $ansible_root/ansible.cfg <<EOF
local_tmp=$ansible_root/local_tmp
remote_tmp=$ansible_root/remote_tmp
EOF
cat > $ansible_root/hosts <<EOF
localhost ansible_connection=local
EOF
echo "##" > $fileout
cat $file > $fileout
export ANSIBLE_CONFIG=$ansible_root/ansible.cfg
sudo -H -E /tmp/apply-ansible-env/bin/ansible-playbook -f1 --limit localhost playbooks/remote_puppet_adhoc.yaml -e puppet_environment=production -e manifest=`pwd`/$file -e puppet_noop=true -e puppet_logdest=$fileout
sudo -H -E /tmp/apply-ansible-env/bin/ansible-playbook -i $ansible_root/hosts -f1 playbooks/remote_puppet_adhoc.yaml -e puppet_environment=production -e manifest=`pwd`/$file -e puppet_noop=true -e puppet_logdest=$fileout
ret=$?
if [ $ret -ne 0 ]; then
mv $fileout $fileout.FAILED