我在set_fact中有一个变量值,现在我需要把这个值附加到配置文件中,但是这个配置文件来自AMI,并且配置文件中没有定义变量。
例如:行动手册.yml
- name: Get id
set_fact:
id: "{{ output.stdout }}"
file.config
ID =
注意:如果ID =“{{ id }}”,则可以修复此问题,但配置文件中没有此ID。我需要传递来自playbook.yml的ID值
我试过什么playbook.yml
- name: Get id
set_fact:
id: "{{ output.stdout }}"
- name: append value
shell: "{{ item }}"
- ID = "{{ id }}"
我所拥有的
file.config
ID =
ID = 1233455
我期待的是:file.config
ID = 1233455
注意:file.config ID =〈需要从文件中删除此行或在此处追加值,不应有任何重复〉
1条答案
按热度按时间b5buobof1#
简而言之: