From d4d0ae0e4034362a37234141ad99af1c6ee36888 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Mon, 4 Jun 2018 23:55:11 +0200 Subject: [PATCH] Add playbook to upgrade puppet Add a playbook to rerun install_puppet.sh with PUPPET_VERSION=4. Also make the install_modules.sh script smarter about figuring out the puppet version so that the update_puppet.yaml playbook, which updates the puppet config and puppet modules but not the puppet package, does not need to be changed. When we're ready to start upgrading nodes, we'll add them to the puppet4 group in `modules/openstack_project/files/puppetmaster/groups.txt`. Change-Id: Ic41d277b2d70e7c25669e0c07e668fb9479b8abf --- install_modules.sh | 5 ++++- playbooks/update_puppet_version.yaml | 12 ++++++++++++ run_all.sh | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 playbooks/update_puppet_version.yaml diff --git a/install_modules.sh b/install_modules.sh index 58e399f3be..8b048f7cd0 100755 --- a/install_modules.sh +++ b/install_modules.sh @@ -14,7 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -export PUPPET_VERSION=${PUPPET_VERSION:-3} +function puppet_version { + PATH=/opt/puppetlabs/bin:$PATH puppet --version | cut -d '.' -f 1 +} +export PUPPET_VERSION=$(puppet_version) if [ "$PUPPET_VERSION" == "3" ] ; then export MODULE_PATH=/etc/puppet/modules diff --git a/playbooks/update_puppet_version.yaml b/playbooks/update_puppet_version.yaml new file mode 100644 index 0000000000..c8d3f1bf4d --- /dev/null +++ b/playbooks/update_puppet_version.yaml @@ -0,0 +1,12 @@ +- hosts: 'puppet4' + gather_facts: false + tasks: + - git: + repo: https://git.openstack.org/openstack-infra/system-config + dest: /opt/system-config/production + force: yes + - shell: ./install_puppet.sh + args: + chdir: /opt/system-config/production + environment: + PUPPET_VERSION: 4 diff --git a/run_all.sh b/run_all.sh index 35ed289a94..fed06832cd 100755 --- a/run_all.sh +++ b/run_all.sh @@ -32,6 +32,8 @@ set +e # First, sync the puppet repos with all the machines timeout -k 2m 120m ansible-playbook -f 10 ${ANSIBLE_PLAYBOOKS}/update_puppet.yaml +# Update the puppet version +timeout -k 2m 120m ansible-playbook -f 10 ${ANSIBLE_PLAYBOOKS}/update_puppet_version.yaml # Run the git/gerrit/zuul sequence, since it's important that they all work together timeout -k 2m 120m ansible-playbook -f 10 ${ANSIBLE_PLAYBOOKS}/remote_puppet_git.yaml # Run AFS changes separately so we can make sure to only do one at a time