Set mgmt_hieradata in puppet group_vars

This is not a variable describing the system-under-management
bridge.openstack.org - it's a variable that is always true for all
systems in the puppet group.

As a result, update the puppet apply test to figure out which directory
we should be copying modules _from_ - since the puppet4 tests will be
unhappy otherwise.

Change-Id: Iddee83944bd85f69acf4fcfde83dc70304386baf
This commit is contained in:
Monty Taylor 2018-08-17 13:16:30 -05:00
parent dfcd9c5403
commit a634593a05
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
3 changed files with 15 additions and 4 deletions

View File

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

View File

@ -1,3 +1 @@
ansible_python_interpreter: python3
mgmt_hieradata: /etc/ansible/hosts
mgmt_puppet_module_dir: /etc/puppet/modules

View File

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