# Help using two options for a value for a template

**URL:** <https://forum.ansible.com/t/help-using-two-options-for-a-value-for-a-template/28800>\
**Category:** Ansible Project\
**Created:** [October 16, 2018, 7:03pm UTC](https://forum.ansible.com/t/help-using-two-options-for-a-value-for-a-template/28800 "2018-10-16T19:03:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriel.eidlin](https://avatars.discourse-cdn.com/v4/letter/g/c5a1d2/32.png) [@gabriel.eidlin](https://forum.ansible.com/u/gabriel.eidlin)\
**Post date:** [October 16, 2018, 7:03pm UTC](https://forum.ansible.com/t/help-using-two-options-for-a-value-for-a-template/28800/1 "2018-10-16T19:03:51Z")

</div>

Hi guys,

Here is why im triying to do:

im generating passwords and registering the output in a variable like this

- name: Generate Server Password  
raw: Secret=$(az keyvault secret show --name AdminPassword --vault-name “{{ keyvault }}” --query value --output tsv);if [-z $Secret];then echo $(\</dev/urandom tr -dc ‘A-Za-z0-9#()\*+=\>?~’ | head -c 32 );else echo “$Secret” ;fi  
register: AdminPassword

after i have that AdminPassword variable inside a template of azure\_rm\_deployment

AdminPassword:

value: “{{ LogRWebAdminPassword.stdout\_lines[0] }}”

If the passwords generates it works ok. but if the password doesnt generate (cos sometimes we dont want to generate) it fails cos its waiting a value. I tried to use the operator default like this but it doues not work

AdminPassword:  
value: “{{ LogRWebAdminPassword.stdout\_lines[0] | default(string) }}”

Anyone has some idea how can i give the AdminPassword value options if the 1st one fails?

Thanks a lot!
