I need to replace a variable that has the extra argument passed to it via CLI.
./deploy.yml -e 'jira_ticket=REL-78'
I can't get it to strip out 'deploylist/REL-78' because I'm passing in 'jira_ticket' If i hardcode the varible ('REL-78') it works perfectly.
- name: Set fact
set_fact: deploy_list"{{ item | replace('deploylist/{{ jira_ticket }}/', '')"
with_items: ' {{ modules_to_deploy.value }}'
register: deploy_list_result
ok: [127.0.0.1] => (item=deploylist/REL-78/api)
ok: [127.0.0.1] => (item=deploylist/REL-78/ariaapi)
ok: [127.0.0.1] => (item=deploylist/REL-78/ariaquery)
ok: [127.0.0.1] => (item=deploylist/REL-78/ariaserver)
ok: [127.0.0.1] => (item=deploylist/REL-78/dashboardidp)
ok: [127.0.0.1] => (item=deploylist/REL-78/oracle)
ok: [127.0.0.1] => (item=deploylist/REL-78/uisp)
ok: [127.0.0.1] => (item=deploylist/REL-78/ui)
How about this... (I also added =
and closing }}
)
- name: Set fact
set_fact: deploy_list="{{ item | replace('deploylist/'+jira_ticket+'/', '') }}"
with_items: modules_to_deploy.value
register: deploy_list_result
Note that you don't have to stringify an argument for with_items
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With