如何修改中的答案
Search Dictionary Values in Ansible
我有一本字典:
filenames_for_version:
1.0:
file1: "Hello.txt"
file2: "Goodbye.txt"
2.0:
file1: "HelloWorld.txt"
file2: "GoodbyeWorld.txt"
现在我想写一个任务,做。。。
- name: Get the corresponding **file1** for the version
set_fact: f1_4_ver={{ what do I put here??? }}
- name: Get the corresponding **file2** for the version
set_fact: f2_4_ver={{ what do I put here??? }}
我希望在调用playbook时能够将版本作为CLI参数传递,例如。,
$ ansible-playbook -i "localhost," -c local get_filename_for_version.yml -e "version=1.0"
…如果我通过版本=1.0,我得到。。。
f1_4_ver=Hello.txt
f2_4_ver=Goodbye.txt
…如果我通过版本=2.0,我得到。。。
f1_4_ver=HelloWorld.txt
f2_4_ver=GoodbyeWorld.txt
在。。
{{ what do I put here??? }}
…我任务的一部分?