From ed9bb84817415f915af0327de744113875f2f9cd Mon Sep 17 00:00:00 2001 From: milkmix Date: Sun, 17 Mar 2019 12:32:01 +0100 Subject: [PATCH] replaced external command w/ default zones --- roles/cloud-cloudstack/defaults/main.yml | 49 +++++++++++++++++++++++- roles/cloud-cloudstack/tasks/prompts.yml | 8 +--- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/roles/cloud-cloudstack/defaults/main.yml b/roles/cloud-cloudstack/defaults/main.yml index 31eba013..7f45ca37 100644 --- a/roles/cloud-cloudstack/defaults/main.yml +++ b/roles/cloud-cloudstack/defaults/main.yml @@ -1,2 +1,49 @@ --- -cloudstack_venv: "{{ playbook_dir }}/configs/.venvs/cloudstack" \ No newline at end of file +cloudstack_venv: "{{ playbook_dir }}/configs/.venvs/cloudstack" +_cloudstack_zones: > + [ + { + "allocationstate": "Enabled", + "dhcpprovider": "VirtualRouter", + "id": "1128bd56-b4d9-4ac6-a7b9-c715b187ce11", + "localstorageenabled": true, + "name": "ch-gva-2", + "networktype": "Basic", + "securitygroupsenabled": true, + "tags": [], + "zonetoken": "token" + }, + { + "allocationstate": "Enabled", + "dhcpprovider": "VirtualRouter", + "id": "91e5e9e4-c9ed-4b76-bee4-427004b3baf9", + "localstorageenabled": true, + "name": "ch-dk-2", + "networktype": "Basic", + "securitygroupsenabled": true, + "tags": [], + "zonetoken": "token" + }, + { + "allocationstate": "Enabled", + "dhcpprovider": "VirtualRouter", + "id": "4da1b188-dcd6-4ff5-b7fd-bde984055548", + "localstorageenabled": true, + "name": "at-vie-1", + "networktype": "Basic", + "securitygroupsenabled": true, + "tags": [], + "zonetoken": "token" + }, + { + "allocationstate": "Enabled", + "dhcpprovider": "VirtualRouter", + "id": "35eb7739-d19e-45f7-a581-4687c54d6d02", + "localstorageenabled": true, + "name": "de-fra-1", + "networktype": "Basic", + "securitygroupsenabled": true, + "tags": [], + "zonetoken": "token" + } + ] \ No newline at end of file diff --git a/roles/cloud-cloudstack/tasks/prompts.yml b/roles/cloud-cloudstack/tasks/prompts.yml index b10c305d..db2303bf 100644 --- a/roles/cloud-cloudstack/tasks/prompts.yml +++ b/roles/cloud-cloudstack/tasks/prompts.yml @@ -1,16 +1,12 @@ --- - block: - - name: List zones on configured cloud provider - local_action: shell "{{ cloudstack_venv }}/bin/cs" listZones - register: cs_zones_list - - name: Parse zones from output set_fact: - _cs_zones: "{{cs_zones_list.stdout | from_json }}" + _cs_zones: "{{ _cloudstack_zones | from_json }}" - name: Extract zones from output set_fact: - cs_zones: "{{ _cs_zones.zone | sort(attribute='name') }}" + cs_zones: "{{ _cs_zones | sort(attribute='name') }}" - name: Set the default zone set_fact: