summaryrefslogtreecommitdiff
path: root/mason
diff options
context:
space:
mode:
Diffstat (limited to 'mason')
-rw-r--r--mason/ansible/hosts1
-rw-r--r--mason/ansible/mason-setup.yml56
-rwxr-xr-xmason/mason-report.sh6
-rw-r--r--mason/mason-setup.service16
-rw-r--r--mason/mason.service2
-rwxr-xr-xmason/mason.sh2
-rw-r--r--mason/share/mason.conf12
7 files changed, 90 insertions, 5 deletions
diff --git a/mason/ansible/hosts b/mason/ansible/hosts
new file mode 100644
index 00000000..5b97818d
--- /dev/null
+++ b/mason/ansible/hosts
@@ -0,0 +1 @@
+localhost ansible_connection=local
diff --git a/mason/ansible/mason-setup.yml b/mason/ansible/mason-setup.yml
new file mode 100644
index 00000000..70c77871
--- /dev/null
+++ b/mason/ansible/mason-setup.yml
@@ -0,0 +1,56 @@
+---
+- hosts: localhost
+ vars_files:
+ - "/etc/mason/mason.conf"
+ tasks:
+
+
+ - fail: msg='TROVE_ID is mandatory'
+ when: TROVE_ID is not defined
+
+ - fail: msg='TROVE_HOST is mandatory'
+ when: TROVE_HOST is not defined
+
+ - fail: msg='ARTIFACT_CACHE_SERVER is mandatory'
+ when: ARTIFACT_CACHE_SERVER is not defined
+
+ - fail: msg='MASON_CLUSTER_MORPHOLOGY is mandatory'
+ when: MASON_CLUSTER_MORPHOLOGY is not defined
+
+ - fail: msg='MASON_DEFINITIONS_REF is mandatory'
+ when: MASON_DEFINITIONS_REF is not defined
+
+ - fail: msg='MASON_DISTBUILD_ARCH is mandatory'
+ when: MASON_DISTBUILD_ARCH is not defined
+
+ - fail: msg='MASON_TEST_HOST is mandatory'
+ when: MASON_TEST_HOST is not defined
+
+ - fail: msg='CONTROLLERHOST is mandatory'
+ when: CONTROLLERHOST is not defined
+
+ - name: Create the Mason configuration file
+ template: src=/usr/share/mason-setup/{{ item }} dest=/etc/{{ item }}
+ with_items:
+ - mason.conf
+
+ - name: Enable the mason service
+ service: name=mason.service enabled=yes
+ register: mason_service
+ - name: Restart the mason service
+ service: name=mason.service state=restarted
+ when: mason_service|changed
+
+ - name: Enable the mason timer
+ service: name=mason.timer enabled=yes
+ register: mason_timer
+ - name: Restart the mason timer
+ service: name=mason.timer state=restarted
+ when: mason_timer|changed
+
+ - name: Enable the httpd service
+ service: name=httpd.service enabled=yes
+ register: httpd_service
+ - name: Restart the httpd service
+ service: name=httpd state=restarted
+ when: httpd_service|changed
diff --git a/mason/mason-report.sh b/mason/mason-report.sh
index 23182cc9..9c20b65b 100755
--- a/mason/mason-report.sh
+++ b/mason/mason-report.sh
@@ -2,9 +2,9 @@
set -x
-. /root/mason.conf
+. /etc/mason.conf
-REPORT_PATH=/root/report.html
+REPORT_PATH=/var/mason/report.html
SERVER_PATH=/srv/mason
sed_escape() {
@@ -210,7 +210,7 @@ update_report_time "$START_TIME"
cp "$REPORT_PATH" "$SERVER_PATH/index.html"
logfile="$(mktemp)"
-/root/mason.sh 2>&1 | tee "$logfile"
+/usr/lib/mason/mason.sh 2>&1 | tee "$logfile"
case "${PIPESTATUS[0]}" in
0)
RESULT=pass
diff --git a/mason/mason-setup.service b/mason/mason-setup.service
new file mode 100644
index 00000000..60403bde
--- /dev/null
+++ b/mason/mason-setup.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Run mason-setup Ansible scripts
+Requires=network.target
+After=network.target
+Requires=opensshd.service
+After=opensshd.service
+
+# If there's a shared /var subvolume, it must be mounted before this
+# unit runs.
+Requires=local-fs.target
+After=local-fs.target
+
+ConditionPathExists=/etc/mason/mason.conf
+
+[Service]
+ExecStart=/usr/bin/ansible-playbook -v -i /usr/lib/mason-setup/ansible/hosts /usr/lib/mason-setup/ansible/mason-setup.yml
diff --git a/mason/mason.service b/mason/mason.service
index 16b5dc3f..ab2338c5 100644
--- a/mason/mason.service
+++ b/mason/mason.service
@@ -3,7 +3,7 @@ Description=Mason: Continuous Delivery Service
[Service]
User=root
-ExecStart=/root/mason-report.sh
+ExecStart=/usr/lib/mason/mason-report.sh
[Install]
WantedBy=multi-user.target
diff --git a/mason/mason.sh b/mason/mason.sh
index 13ea21db..32aab032 100755
--- a/mason/mason.sh
+++ b/mason/mason.sh
@@ -4,7 +4,7 @@ set -e
set -x
# Load our deployment config
-. /root/mason.conf
+. /etc/mason.conf
if [ ! -e ws ]; then
morph init ws
diff --git a/mason/share/mason.conf b/mason/share/mason.conf
new file mode 100644
index 00000000..b323896d
--- /dev/null
+++ b/mason/share/mason.conf
@@ -0,0 +1,12 @@
+# This file is generarated by the mason-setup systemd unit.
+# If you want to change the configuration, change the configuration
+# in /etc/mason/mason.conf and restart the service.
+
+ARTIFACT_CACHE_SERVER={{ ARTIFACT_CACHE_SERVER|quote }}
+UPSTREAM_TROVE_ADDRESS={{ TROVE_HOST|quote }}
+DEFINITIONS_REF={{ MASON_DEFINITIONS_REF|quote }}
+DISTBUILD_ARCH={{ MASON_DISTBUILD_ARCH|quote }}
+DISTBUILD_CONTROLLER_ADDRESS={{ CONTROLLERHOST|quote }}
+TROVE_ID={{ TROVE_ID|quote }}
+BUILD_CLUSTER_MORPHOLOGY={{ MASON_CLUSTER_MORPHOLOGY|quote }}
+TEST_VM_HOST_SSH_URL={{ MASON_TEST_HOST|quote }}