diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-01-14 17:06:33 +0000 |
---|---|---|
committer | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-03-18 16:30:56 +0000 |
commit | 426a6f761bcc734f2b53a088e4b86de24c62e321 (patch) | |
tree | 7234dca64154ac1459fd48bcc93e07d82b3de32b | |
parent | 394da104fda75977fce44212d3051de973102c2e (diff) | |
download | morph-426a6f761bcc734f2b53a088e4b86de24c62e321.tar.gz |
Add Ansible playbooks for distbuild admin
-rw-r--r-- | distbuild/ansible/restart.yaml | 30 | ||||
-rw-r--r-- | distbuild/ansible/run-from-morph-source-tree.sh.template | 6 | ||||
-rw-r--r-- | distbuild/ansible/use-latest-morph.yaml | 28 |
3 files changed, 64 insertions, 0 deletions
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 |