How to write dynamic variable in Ansible playbook

前端 未结 3 361
一整个雨季
一整个雨季 2021-01-30 10:51

Based on extra vars parameter I Need to write variable value in ansible playbook

ansible-playbook playbook.yml -e \"param1=value1 param         


        
3条回答
  •  情歌与酒
    2021-01-30 11:30

    I would first suggest that you step back and look at organizing your plays to not require such complexity, but if you really really do, use the following:

       vars:
        myvariable: "{{[param1|default(''), param2|default(''), param3|default('')]|join(',')}}"
    

提交回复
热议问题