diff options
-rw-r--r-- | mason.configure | 16 | ||||
-rw-r--r-- | mason/ansible/mason-setup.yml | 22 | ||||
-rwxr-xr-x | mason/mason.sh | 2 | ||||
-rw-r--r-- | mason/share/os.conf (renamed from mason/os.conf) | 10 |
4 files changed, 44 insertions, 6 deletions
diff --git a/mason.configure b/mason.configure index 995e098b..0c345708 100644 --- a/mason.configure +++ b/mason.configure @@ -43,6 +43,7 @@ ROOT="$1" mkdir -p "$ROOT"/usr/lib/mason cp mason/mason.sh "$ROOT"/usr/lib/mason/mason.sh cp mason/mason-report.sh "$ROOT"/usr/lib/mason/mason-report.sh +cp mason/os-init-script "$ROOT"/usr/lib/mason/os-init-script cp mason/mason.timer "$ROOT"/etc/systemd/system/mason.timer @@ -120,6 +121,21 @@ mason_configuration={ yaml.dump(mason_configuration, sys.stdout, default_flow_style=False) EOF +if [ "$TEST_INFRASTRUCTURE_TYPE" = "openstack" ]; then + python <<'EOF' >"$MASON_DATA/os.conf" +import os, sys, yaml + +openstack_credentials={ + 'OS_USERNAME': os.environ['OPENSTACK_USER'], + 'OS_TENANT_NAME': os.environ['OPENSTACK_TENANT'], + 'OS_TENANT_ID': os.environ['OPENSTACK_TENANT_ID'], + 'OS_AUTH_URL': os.environ['OPENSTACK_AUTH_URL'], + 'OS_PASSWORD': os.environ['OPENSTACK_PASSWORD'], +} + +yaml.dump(openstack_credentials, sys.stdout, default_flow_style=False) +EOF +fi ########################################################################## # Enable services 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 }} |