summaryrefslogtreecommitdiff
path: root/mason
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2014-10-20 08:07:27 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2014-10-27 09:09:37 +0000
commitee5a2bda0f645315376833c2ad91d7c3314c8c0b (patch)
tree33f653488bef7835bfe3a176123886ecfa082468 /mason
parent7c2b80e4d63e331e429185de73c01a192af6de00 (diff)
downloaddefinitions-ee5a2bda0f645315376833c2ad91d7c3314c8c0b.tar.gz
Use Ansible to generate config for OpenStack
Diffstat (limited to 'mason')
-rw-r--r--mason/ansible/mason-setup.yml22
-rwxr-xr-xmason/mason.sh2
-rw-r--r--mason/share/os.conf (renamed from mason/os.conf)10
3 files changed, 28 insertions, 6 deletions
diff --git a/mason/ansible/mason-setup.yml b/mason/ansible/mason-setup.yml
index 3b73d6d5..08490e78 100644
--- a/mason/ansible/mason-setup.yml
+++ b/mason/ansible/mason-setup.yml
@@ -2,6 +2,7 @@
- hosts: localhost
vars_files:
- "/etc/mason/mason.conf"
+ - "/etc/mason/os.conf"
tasks:
@@ -35,11 +36,32 @@
- fail: msg='OPENSTACK_NETWORK_ID is mandatory when TEST_INFRASTRUCTURE_TYPE=openstack'
when: TEST_INFRASTRUCTURE_TYPE == "openstack" and OPENSTACK_NETWORK_ID is not defined
+ - fail: msg='OS_USERNAME is mandatory when TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_USERNAME is not defined
+
+ - fail: msg='OS_PASSWORD is mandatory when TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_PASSWORD is not defined
+
+ - fail: msg='OS_TENANT_ID is mandatory when TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_TENANT_ID is not defined
+
+ - fail: msg='OS_TENANT_NAME is mandatory when TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_TENANT_NAME is not defined
+
+ - fail: msg='OS_AUTH_URL is mandatory when TEST_INFRASTRUCTURE_TYPE=openstack'
+ when: TEST_INFRASTRUCTURE_TYPE == "openstack" and OS_AUTH_URL is not defined
+
- name: Create the Mason configuration file
template: src=/usr/share/mason-setup/{{ item }} dest=/etc/{{ item }}
with_items:
- mason.conf
+ - name: Create the OpenStack credentials file
+ template: src=/usr/share/mason-setup/{{ item }} dest=/etc/{{ item }}
+ with_items:
+ - os.conf
+ when: TEST_INFRASTRUCTURE_TYPE == "openstack"
+
- name: Enable the mason service
service: name=mason.service enabled=yes
register: mason_service
diff --git a/mason/mason.sh b/mason/mason.sh
index 4356e818..5d27b7cf 100755
--- a/mason/mason.sh
+++ b/mason/mason.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Load OpenStack credentials
-. /root/os.conf
+. /etc/os.conf
set -e
set -x
diff --git a/mason/os.conf b/mason/share/os.conf
index 3c5d0ef9..21ef398c 100644
--- a/mason/os.conf
+++ b/mason/share/os.conf
@@ -14,17 +14,17 @@
#
# *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0. We
# will use the 1.1 *compute api*
-export OS_AUTH_URL=<os-auth-url>
+export OS_AUTH_URL={{ OS_AUTH_URL|quote }}
# With the addition of Keystone we have standardized on the term **tenant**
# as the entity that owns the resources.
-export OS_TENANT_ID=<os-tenant-id>
-export OS_TENANT_NAME="<os-tenant>"
+export OS_TENANT_ID={{ OS_TENANT_ID|quote }}
+export OS_TENANT_NAME={{ OS_TENANT_NAME|quote }}
# In addition to the owning entity (tenant), openstack stores the entity
# performing the action as the **user**.
-export OS_USERNAME="<os-user>"
+export OS_USERNAME={{ OS_USERNAME|quote }}
# With Keystone you pass the keystone password.
-export OS_PASSWORD="<os-pass>"
+export OS_PASSWORD={{ OS_PASSWORD|quote }}