I've been working this issue for a week now. The code used to work perfectly and now it fails. Here is the error I get:
I get a similar error when I target CentOS 9.
ansible-core 2.14.3
python 3.11.2
jinja version = 3.1.2
default.yml is being read in as I refer to other variables in the same file. Can anyone see an error that I've missed?
iptables_directory:
CentOS: "/etc/sysconfig"
Fedora: "/etc/sysconfig"
Rocky: "/etc/sysconfig"
Debian: "/etc/iptables"
Ubuntu: "/etc/iptables"
iptables_v4_rules:
CentOS: "{{ iptables_directory[ansible_distribution] }}/iptables"
Fedora: "{{ iptables_directory[ansible_distribution] }}/iptables"
Rocky: "{{ iptables_directory[ansible_distribution] }}/iptables"
Debian: "{{ iptables_directory[ansible_distribution] }}/rules.v4"
Ubuntu: "{{ iptables_directory[ansible_distribution] }}/rules.v4"
(I added "Fedora" because that's what I'm testing on; otherwise this
doesn't work at all.)iptables_directory:
CentOS: "/etc/sysconfig"
Fedora: "/etc/sysconfig"
Rocky: "/etc/sysconfig"
Debian: "/etc/iptables"
Ubuntu: "/etc/iptables"
iptables_v4_rules:
CentOS: "{{ iptables_directory['CentOS'] }}/iptables"
Fedora: "{{ iptables_directory['Fedora'] }}/iptables"
Rocky: "{{ iptables_directory['Rocky'] }}/iptables"
Debian: "{{ iptables_directory['Debian'] }}/rules.v4"
Ubuntu: "{{ iptables_directory['Ubuntu'] }}/rules.v4"
In any case, it looks like somehow you've tricked the "lazy
evaluation" engine to be even more lazy than it's supposed to be,
because it looks like it isn't resolving the templates in the
values. Not sure how you've managed that, but I'd really like to
know!Default.yml is at the playbook level in a folder called group_vars. It is being read in by my playbook like this:
vars_files:
- group_vars/default.yml
The error appears to be in '/work/armory/roles/xxx/tasks/xxx.yml': line 266, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Save new iptables - IPv4
^ here
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/dc20f5fa-0045-4673-915f-8668c47d3acdn%40googlegroups.com.
When I make Todd's changes, I get the same original error EXCEPT it tells me CentOS is not a dict, even though I am targeting a Debian box.
Dick, are you saying that the file all.yml in the group_vars folder does not need to be explicitly stated in my playbook?
We suffered a bit initially because in some of our projects
different competing interests clashed over ownership of the ./group_vars/all.yml file. When we
realized we could have files ./group_vars/all/interest_aaa.yml,
./group_vars/all/interest_bbb.yml, ./group_vars/all/interest_ccc.yml, ./group_vars/all/interest_ddd.yml, etc.,
then the competition for that namespace became cooperation, and
things just got much easier.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLbksQ5HTbbD4xcofM8-e2LUQB8eAFDF5%2BYV%2BGOXv3J3%2BQ%40mail.gmail.com.
-- Todd
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/irvn6QeOB_w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4858ac06-ca17-447e-a345-d52724145520%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/634560b6-d90a-4895-aecf-e872bf992388n%40googlegroups.com.