added prompt to ask for cloudastack.ini file location if none specified in env

This commit is contained in:
milkmix 2019-03-19 08:46:28 +01:00
parent d06c4d2a74
commit 1519bf11fe
2 changed files with 27 additions and 2 deletions

View file

@ -61,6 +61,8 @@
ansible_ssh_user: ubuntu
environment:
PYTHONPATH: "{{ cloudstack_venv }}/lib/python2.7/site-packages/"
CLOUDSTACK_CONFIG: "{{ _cs_config }}"
CLOUDSTACK_REGION: "{{ _cs_region.user_input }}"
rescue:
- debug: var=fail_hint

View file

@ -1,5 +1,28 @@
---
- block:
- set_fact:
_cs_config: "{{ lookup('env', 'CLOUDSTACK_CONFIG') }}"
- pause:
prompt: |
Enter path for cloudstack.ini file
[~/.cloudstack.ini]
register: _cs_config_input
when: _cs_config == ""
- set_fact:
_cs_config_input: "{% if _cs_config_input.user_input == ''%}{{ '~/.cloudstack.ini' }}{% else %}{{ _cs_config_input.user_input }}{% endif %}"
when: _cs_config == ""
- set_fact:
_cs_config: "{% if _cs_config == '' %}{{ _cs_config_input }}{% else %}{{ _cs_config }}{% endif %}"
- pause:
prompt: |
Specify region to use in cloudstack.ini_file
[default]
register: _cs_region
- name: Parse zones from output
set_fact:
_cs_zones: "{{ _cloudstack_zones | from_json }}"
@ -19,8 +42,8 @@
prompt: |
What zone should the server be located in?
{% for z in cs_zones %}
{{ loop.index }}. {{ z['name'] }}
{% endfor %}
{{ loop.index }}. {{ z['name'] }}
{% endfor %}
Enter the number of your desired zone
[{{ default_zone }}]