mirror of
https://github.com/trailofbits/algo.git
synced 2025-08-13 08:13:01 +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
|
||||
jmespath==0.9.4
|
||||
ansible==2.5.2
|
|
@ -10,8 +10,8 @@
|
|||
- set_fact:
|
||||
algo_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 ] }}
|
||||
{%- else %}{{ cs_zones[default_region | int - 1] }}{% endif %}
|
||||
{%- 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]['name'] }}{% endif %}
|
||||
|
||||
- name: Security group created
|
||||
cs_securitygroup:
|
||||
|
|
|
@ -6,20 +6,24 @@
|
|||
|
||||
- name: Parse zones from output
|
||||
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
|
||||
set_fact:
|
||||
default_zone: >-
|
||||
{% for z in cs_zones %}
|
||||
{%- if z == "ch-gva-2" %}{{ loop.index }}{% endif %}
|
||||
{%- if z['name'] == "ch-gva-2" %}{{ loop.index }}{% endif %}
|
||||
{%- endfor %}
|
||||
|
||||
- pause:
|
||||
prompt: |
|
||||
What zone should the server be located in?
|
||||
{% for z in cs_zones %}
|
||||
{{ loop.index }}. {{ z }}
|
||||
{{ loop.index }}. {{ z['name'] }}
|
||||
{% endfor %}
|
||||
|
||||
Enter the number of your desired zone
|
||||
|
|
Loading…
Add table
Reference in a new issue