From 426a6f761bcc734f2b53a088e4b86de24c62e321 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Wed, 14 Jan 2015 17:06:33 +0000 Subject: Add Ansible playbooks for distbuild admin --- distbuild/ansible/restart.yaml | 30 ++++++++++++++++++++++ .../ansible/run-from-morph-source-tree.sh.template | 6 +++++ distbuild/ansible/use-latest-morph.yaml | 28 ++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 distbuild/ansible/restart.yaml create mode 100644 distbuild/ansible/run-from-morph-source-tree.sh.template create mode 100644 distbuild/ansible/use-latest-morph.yaml diff --git a/distbuild/ansible/restart.yaml b/distbuild/ansible/restart.yaml new file mode 100644 index 00000000..a587a95e --- /dev/null +++ b/distbuild/ansible/restart.yaml @@ -0,0 +1,30 @@ +# Restart all Morph instances on a Baserock distbuild network. +# +# This will abort any running builds. +# +# This is an Ansible playbook. Run with: +# +# ansible-playbook -i distbuild-hosts restart.yaml +# +# You will need a file named 'distbuild-hosts' describing your distbuild +# network. +--- + +# The order in which the processes are restarted is important! (Sadly). +- hosts: controller + gather_facts: false + tasks: + - name: restart controller processes + service: name={{ item }} state=restarted + with_items: + - morph-controller.service + - morph-controller-helper.service + +- hosts: workers + gather_facts: false + tasks: + - name: restart worker processes + service: name={{ item }} state=restarted + with_items: + - morph-worker.service + - morph-worker-helper.service diff --git a/distbuild/ansible/run-from-morph-source-tree.sh.template b/distbuild/ansible/run-from-morph-source-tree.sh.template new file mode 100644 index 00000000..0fa7ebd0 --- /dev/null +++ b/distbuild/ansible/run-from-morph-source-tree.sh.template @@ -0,0 +1,6 @@ +#!/bin/sh + +# Script to use version of a program from a checkout of the morph.git source tree. + +source_path=/srv/morph +PYTHONPATH="$source_path" "$source_path/{{ item }}" "$@" diff --git a/distbuild/ansible/use-latest-morph.yaml b/distbuild/ansible/use-latest-morph.yaml new file mode 100644 index 00000000..9f2716d2 --- /dev/null +++ b/distbuild/ansible/use-latest-morph.yaml @@ -0,0 +1,28 @@ +# Upgrade the version of Morph used on a Baserock distbuild network. +# +# This allows quickly testing a new version of Morph without having to fully +# build and deploy a new Baserock 'build' system. You should run the +# 'restart.yaml' playbook after this one. +# +# This is an Ansible playbook. Run with: +# +# ansible-playbook -i distbuild-hosts use-latest-morph.yaml +# +# You will need a file named 'distbuild-hosts' describing your distbuild +# network. + +--- +- hosts: all + gather_facts: false + vars: + - TROVE_HOST: git.baserock.org + - MORPH_VERSION: sam/distbuild-build-logs + tasks: + - name: check out Morph from Git + git: dest=/srv/morph version={{ MORPH_VERSION }} repo=git://{{ TROVE_HOST }}/baserock/baserock/morph accept_hostkey=True + + - name: ensure latest Morph is used + template: backup=yes src=run-from-morph-source-tree.sh.template dest=/usr/bin/{{ item }} mode=0755 + with_items: + - morph + - distbuild-helper -- cgit v1.2.1