summaryrefslogtreecommitdiff
path: root/zuul/ansible/mason-setup.yml
diff options
context:
space:
mode:
Diffstat (limited to 'zuul/ansible/mason-setup.yml')
-rw-r--r--zuul/ansible/mason-setup.yml117
1 files changed, 117 insertions, 0 deletions
diff --git a/zuul/ansible/mason-setup.yml b/zuul/ansible/mason-setup.yml
new file mode 100644
index 00000000..1f9babc6
--- /dev/null
+++ b/zuul/ansible/mason-setup.yml
@@ -0,0 +1,117 @@
+---
+- 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='GERRIT_USER is mandatory'
+ when: GERRIT_USER is not defined
+
+ - fail: msg='GERRIT_HOSTNAME is mandatory'
+ when: GERRIT_HOSTNAME is not defined
+
+ - fail: msg='GERRIT_HTTP_PORT is mandatory'
+ when: GERRIT_HTTP_PORT is not defined
+
+ - fail: msg='GERRIT_GIT_PORT is mandatory'
+ when: GERRIT_GIT_PORT is not defined
+
+ - fail: msg='GERRIT_SSH_KEY_PATH is mandatory'
+ when: GERRIT_SSH_KEY_PATH is not defined
+
+ - fail: msg='GEARMAN_HOST is mandatory'
+ when: GEARMAN_HOST is not defined
+
+ - fail: msg='GEARMAN_PORT is mandatory'
+ when: GEARMAN_PORT is not defined
+
+ - fail: msg='START_GEARMAN is mandatory'
+ when: START_GEARMAN is not defined
+
+ - fail: msg='MASON_CLUSTER_MORPHOLOGY is mandatory'
+ when: MASON_CLUSTER_MORPHOLOGY is not defined
+
+ - fail: msg='MASON_ARCHITECTURE is mandatory'
+ when: MASON_ARCHITECTURE is not defined
+
+ - fail: msg='MASON_TEST_HOSTS is mandatory'
+ when: MASON_TEST_HOSTS is not defined
+
+ - fail: msg='MASON_DISTBUILD_CONTROLLERS is mandatory'
+ when: MASON_DISTBUILD_CONTROLLERS is not defined
+
+ - fail: msg='MASON_TEST_INFRASTRUCTURE_TYPE is mandatory'
+ when: MASON_TEST_INFRASTRUCTURE_TYPE is not defined
+
+ - fail: msg='MASON_UPSTREAM_TROVE is mandatory'
+ when: MASON_UPSTREAM_TROVE is not defined
+
+ - fail: msg='OPENSTACK_NETWORK_ID is mandatory when MASON_TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: MASON_TEST_INFRASTRUCTURE_TYPE == "openstack" and OPENSTACK_NETWORK_ID is not defined
+
+ - fail: msg='OS_USERNAME is mandatory when MASON_TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: MASON_TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_USERNAME is not defined
+
+ - fail: msg='OS_PASSWORD is mandatory when MASON_TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: MASON_TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_PASSWORD is not defined
+
+ - fail: msg='OS_TENANT_ID is mandatory when MASON_TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: MASON_TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_TENANT_ID is not defined
+
+ - fail: msg='OS_TENANT_NAME is mandatory when MASON_TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: MASON_TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_TENANT_NAME is not defined
+
+ - fail: msg='OS_AUTH_URL is mandatory when MASON_TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: MASON_TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_AUTH_URL is not defined
+
+ - name: Create required configuration files
+ template: src=/usr/share/mason-setup/{{ item }} dest=/etc/{{ item }}
+ with_items:
+ - zuul.conf
+ - turbo-hipster-config.yaml
+ - lighttpd.conf
+ - zuul-layout.yaml
+ - zuul-logging.conf
+
+ - name: Create the OpenStack credentials file
+ template: src=/usr/share/mason-setup/{{ item }} dest=/etc/{{ item }}
+ with_items:
+ - os.conf
+ when: MASON_TEST_INFRASTRUCTURE_TYPE == "openstack"
+
+ - name: Enable the zuul-server service
+ service: name=zuul-server.service enabled=yes
+ register: zuul_server_service
+ - name: Restart the zuul-server service
+ service: name=zuul-server.service state=restarted
+ when: zuul_server_service|changed
+
+ - name: Enable the zuul-merger service
+ service: name=zuul-merger.service enabled=yes
+ register: zuul_merger_service
+ - name: Restart the zuul-merger service
+ service: name=zuul-merger.service state=restarted
+ when: zuul_merger_service|changed
+
+ - name: Enable the turbo-hipster service
+ service: name=turbo-hipster.service enabled=yes
+ register: turbo_hipster_service
+ - name: Restart the turbo-hipster service
+ service: name=turbo-hipster.service state=restarted
+ when: turbo_hipster_service|changed
+
+ - name: Enable the lighttpd service
+ service: name=lighttpd.service enabled=yes
+ register: lighttpd_service
+ - name: Restart the lighttpd service
+ service: name=lighttpd.service state=restarted
+ when: lighttpd_service|changed