diff --git a/playbooks/group_vars/puppet.yaml b/playbooks/group_vars/puppet.yaml index 5ce8213fd4..708fa99ef1 100644 --- a/playbooks/group_vars/puppet.yaml +++ b/playbooks/group_vars/puppet.yaml @@ -7,4 +7,5 @@ manifest: /opt/system-config/manifests/site.pp manifest_base: /opt/system-config mgmt_manifestpath: /opt/system-config puppet_logdest: syslog - +mgmt_hieradata: /etc/ansible/hosts +mgmt_puppet_module_dir: /etc/puppet/modules diff --git a/playbooks/host_vars/bridge.openstack.org.yaml b/playbooks/host_vars/bridge.openstack.org.yaml index 45f1749680..71b79291b7 100644 --- a/playbooks/host_vars/bridge.openstack.org.yaml +++ b/playbooks/host_vars/bridge.openstack.org.yaml @@ -1,3 +1 @@ ansible_python_interpreter: python3 -mgmt_hieradata: /etc/ansible/hosts -mgmt_puppet_module_dir: /etc/puppet/modules diff --git a/tools/test_puppet_apply.sh b/tools/test_puppet_apply.sh index 0ab31ad787..cea116e2a2 100755 --- a/tools/test_puppet_apply.sh +++ b/tools/test_puppet_apply.sh @@ -14,6 +14,18 @@ # License for the specific language governing permissions and limitations # under the License. +function puppet_version { + # Default to 3 for the cases, like bridge, where there is no puppet + (PATH=/opt/puppetlabs/bin:$PATH puppet --version || echo 3) | cut -d '.' -f 1 +} +export PUPPET_VERSION=$(puppet_version) + +if [ "$PUPPET_VERSION" == "3" ] ; then + export MODULE_PATH=/etc/puppet/modules +elif [ "$PUPPET_VERSION" == "4" ] ; then + export MODULE_PATH=/etc/puppetlabs/code/modules +fi + file=$1 fileout=`pwd`/${file}.out ansible_root=`mktemp -d` @@ -30,7 +42,7 @@ EOF echo "##" > $fileout cat $file > $fileout export ANSIBLE_CONFIG=$ansible_root/ansible.cfg -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 +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 -e mgmt_puppet_module_dir=$MODULE_PATH ret=$? if [ $ret -ne 0 ]; then mv $fileout $fileout.FAILED