mirror of
https://github.com/trailofbits/algo.git
synced 2025-08-13 16:23:00 +02:00
modified json parsing part for zones
This commit is contained in:
parent
2e51d8b744
commit
1ed3e40e90
3 changed files with 10 additions and 7 deletions
|
@ -1,2 +1 @@
|
||||||
ansible==2.5.2
|
ansible==2.5.2
|
||||||
jmespath==0.9.4
|
|
|
@ -10,8 +10,8 @@
|
||||||
- set_fact:
|
- set_fact:
|
||||||
algo_region: >-
|
algo_region: >-
|
||||||
{% if region is defined %}{{ region }}
|
{% if region is defined %}{{ region }}
|
||||||
{%- elif _algo_region.user_input is defined and _algo_region.user_input != "" %}{{ cs_zones[_algo_region.user_input | int -1 ] }}
|
{%- elif _algo_region.user_input is defined and _algo_region.user_input != "" %}{{ cs_zones[_algo_region.user_input | int -1 ]['name'] }}
|
||||||
{%- else %}{{ cs_zones[default_region | int - 1] }}{% endif %}
|
{%- else %}{{ cs_zones[default_region | int - 1]['name'] }}{% endif %}
|
||||||
|
|
||||||
- name: Security group created
|
- name: Security group created
|
||||||
cs_securitygroup:
|
cs_securitygroup:
|
||||||
|
|
|
@ -6,20 +6,24 @@
|
||||||
|
|
||||||
- name: Parse zones from output
|
- name: Parse zones from output
|
||||||
set_fact:
|
set_fact:
|
||||||
cs_zones: "{{cs_zones_list.stdout | from_json | json_query('zone[*].name')}}"
|
_cs_zones: "{{cs_zones_list.stdout | from_json }}"
|
||||||
|
|
||||||
|
- name: Extract zones from output
|
||||||
|
set_fact:
|
||||||
|
cs_zones: "{{ _cs_zones.zone | sort(attribute='name') }}"
|
||||||
|
|
||||||
- name: Set the default zone
|
- name: Set the default zone
|
||||||
set_fact:
|
set_fact:
|
||||||
default_zone: >-
|
default_zone: >-
|
||||||
{% for z in cs_zones %}
|
{% for z in cs_zones %}
|
||||||
{%- if z == "ch-gva-2" %}{{ loop.index }}{% endif %}
|
{%- if z['name'] == "ch-gva-2" %}{{ loop.index }}{% endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
- pause:
|
- pause:
|
||||||
prompt: |
|
prompt: |
|
||||||
What zone should the server be located in?
|
What zone should the server be located in?
|
||||||
{% for z in cs_zones %}
|
{% for z in cs_zones %}
|
||||||
{{ loop.index }}. {{ z }}
|
{{ loop.index }}. {{ z['name'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
Enter the number of your desired zone
|
Enter the number of your desired zone
|
||||||
|
|
Loading…
Add table
Reference in a new issue