Docker – How to set UFW DEFAULT_FORWARD_POLICY using Ansible ufw module

ansibledockerufw

How can I use Ansible's ufw module to set DEFAULT_FORWARD_POLICY="ACCEPT" as recommended when setting up Docker?

I know I can do it with lineinfile, but it would be nice to use the ufw module if possible, and with my limited sysadmin experience it's not clear to me how to do this from the ufw module documentation (and I'd rather not botch firewall rules if possible).

Best Answer

This post seems to be quite old but for somebody looking for this problem the following task worked for me

- name: 'Allow docker DEFAULT_FORWARD_POLICY=ACCEPT'
  ufw: direction=routed default=allow route=yes

Hope that helps someone

Related Topic