Search code examples
variablesansibleufw

ansible ufw configuration : default config different from expected


- name: defaultt policy
  ufw:
    policy: "{{ item.policy }}"
    direction: "{{ item.direction }}"
  with_items: "{{ ufw_default_dict }}"
  become: yes
  notify: reload ufw

ufw_default_dict:
  - { direction: incoming, policy: deny }
  - { direction: outgoing, policy: allow }
  - { direction: routed, policy: allow }

I want my ufw default config as follow : deny (incoming), allow (outgoing), allow (routed)

after using ansible doing the previous task (without any error triggered) I have : deny (incoming), allow (outgoing), disabled (routed) why ?


Solution

  • It's because the rules takes first places and so I couldn't change routed default policy before settings the rules to accept routed.