I did not fully understand the problem, but might worth having a look at variable precedence https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variable-precedence
*Kosala* On Sat, Oct 7, 2023 at 7:07 AM 'Matt Zagrabelny' via Ansible Project < [email protected]> wrote: > Hi Vladamir, > > Thanks for all your help. Unfortunately the variables (and how and where > they are being set) just aren't working the way I am expecting. I'll punt > for now and just set the variable in the hosts.yaml file. > > Very appreciative of your time and energy. > > Cheers, > > -m > > On Thu, Oct 5, 2023 at 1:11 AM Vladimir Botka <[email protected]> wrote: > >> On Wed, 4 Oct 2023 20:45:23 -0500 >> "'Matt Zagrabelny' via Ansible Project" >> <[email protected]> wrote: >> >> > > PLAY [all] ***************************** >> > > >> > > TASK [nftables : debug] **************** >> > > ok: [zed] => >> > > forward_policy: drop >> >> > I would like forward_policy to be "accept" for the nftables role ... >> > I want the "router" role to affect ... "nftables" role. >> >> Create task that will "instantiate" the variable *forward_policy* >> >> shell> cat roles/router/tasks/instantiate_vars.yml >> - set_fact: >> forward_policy: "{{ forward_policy }}" >> when: forward_policy is defined >> >> and run it in the first play *pre_tasks* >> >> shell> cat pb.yml >> - hosts: all >> pre_tasks: >> - include_role: >> name: router >> tasks_from: instantiate_vars >> run_once: true >> roles: >> - nftables >> >> - hosts: router >> roles: >> - router >> >> >> -- >> Vladimir Botka >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/20231005081108.4be4f4cc%40gmail.com >> . >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAOLfK3XKRsFmU39omXCNbk%2BrTsYTnG%2BNN_-w5n1%3DGmnmJoR1rA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAOLfK3XKRsFmU39omXCNbk%2BrTsYTnG%2BNN_-w5n1%3DGmnmJoR1rA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAP7S5HZff2k7U3KiwQfHkbcrG6HwkJokHKeE0z7QUiSwVuZc9A%40mail.gmail.com.
