> $ cat roles/nftables/defaults/main.yaml
> forward_policy: drop
> 
> $ cat roles/router/vars/main.yaml
> forward_policy: accept
> 
> I don't know how to override the variable in the nftables role from within
> the router role.

Is it possible to minimize the example?

shell> tree .
.
├── hosts
├── pb.yml
└── roles
    ├── nftables
    │   ├── defaults
    │   │   └── main.yml
    │   └── tasks
    │       └── main.yml
    └── router
        ├── tasks
        │   └── main.yml
        └── vars
            └── main.yml

shell> cat roles/nftables/defaults/main.yml 
forward_policy: drop
shell> cat roles/nftables/tasks/main.yml 
- debug:
    var: forward_policy

shell> cat roles/router/vars/main.yml 
forward_policy: accept
shell> cat roles/router/tasks/main.yml 
- debug:
    var: forward_policy

shell> cat hosts
[router]
zed
shell> cat pb.yml 
- hosts: all
  roles:
    - nftables

- hosts: router
  roles:
    - router

Running the playbook gives

shell> ansible-playbook pb.yml

PLAY [all] *****************************

TASK [nftables : debug] ****************
ok: [zed] =>
  forward_policy: drop

PLAY [router] **************************

TASK [router : debug] ******************
ok: [zed] =>
  forward_policy: accept

Does this reproduce your problem? If yes what do you expect?


-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20231005003836.3b6eaaed%40gmail.com.

Attachment: pgp7O6lhChJRn.pgp
Description: OpenPGP digital signature

Reply via email to