Reputation: 637
I need to be able to set variables using tasks in Ansible. I use set_fact for this, but cannot seem to access the fact I set with this. What is wrong with the code below:
- name: kludge1
set_fact: fake_y = "{{ [] }}"
- name: Loop
debug:
msg: "{{ item }}"
with_items: "{{ fake_y }}"
Upvotes: 1
Views: 2378
Reputation: 68329
You have spaces before and after =
...
- name: kludge1
set_fact: fake_y="{{ [] }}"
Avoid var=
shortcut syntax. Use original YAML syntax instead, it gives less errors:
- name: kludge1
set_fact:
fake_y: "{{ [] }}"
Upvotes: 1