Merge "Fix puppet config for puppet 4"
This commit is contained in:
commit
d00464016a
@ -14,7 +14,17 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
MODULE_PATH=`puppet config print modulepath | cut -d ':' -f 1`
|
export PUPPET_VERSION=${PUPPET_VERSION:-3}
|
||||||
|
|
||||||
|
if [ "$PUPPET_VERSION" == "3" ] ; then
|
||||||
|
export MODULE_PATH=/etc/puppet/modules
|
||||||
|
elif [ "$PUPPET_VERSION" == "4" ] ; then
|
||||||
|
export MODULE_PATH=/etc/puppetlabs/code/modules
|
||||||
|
else
|
||||||
|
echo "ERROR: unsupported puppet version $PUPPET_VERSION"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
SCRIPT_NAME=$(basename $0)
|
SCRIPT_NAME=$(basename $0)
|
||||||
SCRIPT_DIR=$(readlink -f "$(dirname $0)")
|
SCRIPT_DIR=$(readlink -f "$(dirname $0)")
|
||||||
JUST_CLONED=0
|
JUST_CLONED=0
|
||||||
@ -70,7 +80,7 @@ if [ -z "${!MODULES[*]}" ] && [ -z "${!SOURCE_MODULES[*]}" ] ; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MODULE_LIST=`puppet module list --color=false`
|
MODULE_LIST=`PATH=$PATH:/opt/puppetlabs/bin puppet module list --color=false`
|
||||||
|
|
||||||
# Install modules from source
|
# Install modules from source
|
||||||
for MOD in ${!SOURCE_MODULES[*]} ; do
|
for MOD in ${!SOURCE_MODULES[*]} ; do
|
||||||
|
@ -176,10 +176,12 @@ EOF
|
|||||||
ln -s /usr/bin/pip /usr/bin/pip-python
|
ln -s /usr/bin/pip /usr/bin/pip-python
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wipe out templatedir so we don't get warnings about it
|
if [ "$PUPPET_VERSION" == "3" ] ; then
|
||||||
sed -i '/templatedir/d' /etc/puppet/puppet.conf
|
# Wipe out templatedir so we don't get warnings about it
|
||||||
# Wipe out server, as we don't have one.
|
sed -i '/templatedir/d' /etc/puppet/puppet.conf
|
||||||
sed -i '/server/d' /etc/puppet/puppet.conf
|
# Wipe out server, as we don't have one.
|
||||||
|
sed -i '/server/d' /etc/puppet/puppet.conf
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_puppet_ubuntu {
|
function setup_puppet_ubuntu {
|
||||||
@ -242,10 +244,12 @@ EOF
|
|||||||
--assume-yes dist-upgrade
|
--assume-yes dist-upgrade
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get --option 'Dpkg::Options::=--force-confold' \
|
DEBIAN_FRONTEND=noninteractive apt-get --option 'Dpkg::Options::=--force-confold' \
|
||||||
--assume-yes install -y --force-yes $puppetpkg git $rubypkg
|
--assume-yes install -y --force-yes $puppetpkg git $rubypkg
|
||||||
# Wipe out templatedir so we don't get warnings about it
|
if [ "$PUPPET_VERSION" == "3" ] ; then
|
||||||
sed -i '/templatedir/d' /etc/puppet/puppet.conf
|
# Wipe out templatedir so we don't get warnings about it
|
||||||
# Wipe out server, as we don't have one.
|
sed -i '/templatedir/d' /etc/puppet/puppet.conf
|
||||||
sed -i '/server/d' /etc/puppet/puppet.conf
|
# Wipe out server, as we don't have one.
|
||||||
|
sed -i '/server/d' /etc/puppet/puppet.conf
|
||||||
|
fi
|
||||||
# ensure the agent is stopped and disabled
|
# ensure the agent is stopped and disabled
|
||||||
if [ -f /bin/systemctl ]; then
|
if [ -f /bin/systemctl ]; then
|
||||||
service puppet stop
|
service puppet stop
|
||||||
|
@ -15,19 +15,16 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
ROOT=$(readlink -fn $(dirname $0)/..)
|
ROOT=$(readlink -fn $(dirname $0)/..)
|
||||||
export MODULE_PATH="${ROOT}/modules:/etc/puppet/modules"
|
|
||||||
# MODULE_ENV_FILE sets the list of modules to read from and install and can be
|
# MODULE_ENV_FILE sets the list of modules to read from and install and can be
|
||||||
# overridden by setting it outside the script.
|
# overridden by setting it outside the script.
|
||||||
export MODULE_ENV_FILE=${MODULE_ENV_FILE:-modules.env}
|
export MODULE_ENV_FILE=${MODULE_ENV_FILE:-modules.env}
|
||||||
# PUPPET_MANIFEST sets the manifest that is being tested and can be overridden
|
# PUPPET_MANIFEST sets the manifest that is being tested and can be overridden
|
||||||
# by setting it outside the script.
|
# by setting it outside the script.
|
||||||
export PUPPET_MANIFEST=${PUPPET_MANIFEST:-manifests/site.pp}
|
export PUPPET_MANIFEST=${PUPPET_MANIFEST:-manifests/site.pp}
|
||||||
|
export PUPPET_VERSION=${PUPPET_VERSION:-3}
|
||||||
|
|
||||||
export PUPPET_INTEGRATION_TEST=1
|
export PUPPET_INTEGRATION_TEST=1
|
||||||
|
|
||||||
# Remove previously-installed modules
|
|
||||||
sudo rm -rf /etc/puppet/modules/*
|
|
||||||
|
|
||||||
# These arrays are initialized here and populated in modules.env
|
# These arrays are initialized here and populated in modules.env
|
||||||
|
|
||||||
# Array of modules to be installed key:value is module:version.
|
# Array of modules to be installed key:value is module:version.
|
||||||
@ -45,6 +42,16 @@ source $MODULE_ENV_FILE
|
|||||||
|
|
||||||
# Install puppet
|
# Install puppet
|
||||||
SETUP_PIP=false sudo -E bash -x $ROOT/install_puppet.sh
|
SETUP_PIP=false sudo -E bash -x $ROOT/install_puppet.sh
|
||||||
|
if [ "$PUPPET_VERSION" == "3" ] ; then
|
||||||
|
export MODULE_PATH=/etc/puppet/modules
|
||||||
|
elif [ "$PUPPET_VERSION" == "4" ] ; then
|
||||||
|
export MODULE_PATH=/etc/puppetlabs/code/modules
|
||||||
|
else
|
||||||
|
echo "ERROR: unsupported puppet version $PUPPET_VERSION"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Remove previously-installed modules
|
||||||
|
sudo rm -rf $MODULE_PATH/*
|
||||||
# Install SOURCE_MODULES
|
# Install SOURCE_MODULES
|
||||||
sudo -E bash -x $ROOT/install_modules.sh
|
sudo -E bash -x $ROOT/install_modules.sh
|
||||||
|
|
||||||
@ -52,7 +59,7 @@ sudo -E bash -x $ROOT/install_modules.sh
|
|||||||
cat > clonemap.yaml <<EOF
|
cat > clonemap.yaml <<EOF
|
||||||
clonemap:
|
clonemap:
|
||||||
- name: '(.*?)/puppet-(.*)'
|
- name: '(.*?)/puppet-(.*)'
|
||||||
dest: '/etc/puppet/modules/\2'
|
dest: '$MODULE_PATH/\2'
|
||||||
- name: '(.*?)/ansible-role-(.*)'
|
- name: '(.*?)/ansible-role-(.*)'
|
||||||
dest: '/etc/ansible/roles/\2'
|
dest: '/etc/ansible/roles/\2'
|
||||||
EOF
|
EOF
|
||||||
@ -80,7 +87,7 @@ sudo mv /tmp/hosts /etc/hosts
|
|||||||
sudo mkdir -p /opt/system-config
|
sudo mkdir -p /opt/system-config
|
||||||
sudo ln -sf $(pwd) /opt/system-config/production
|
sudo ln -sf $(pwd) /opt/system-config/production
|
||||||
# Really make sure that the openstack_project module is in the module path
|
# Really make sure that the openstack_project module is in the module path
|
||||||
sudo ln -sf /opt/system-config/production/modules/openstack_project /etc/puppet/modules
|
sudo ln -sf /opt/system-config/production/modules/openstack_project $MODULE_PATH
|
||||||
sudo -H mkdir -p ~/.ansible/tmp
|
sudo -H mkdir -p ~/.ansible/tmp
|
||||||
|
|
||||||
virtualenv --system-site-packages /tmp/apply-ansible-env
|
virtualenv --system-site-packages /tmp/apply-ansible-env
|
||||||
|
Loading…
Reference in New Issue
Block a user