Bootstrap FreeKB - Ansible - Save changes made to iptables using the iptables_state module
Ansible - Save changes made to iptables using the iptables_state module

Updated:   |  Ansible articles

If you are not familiar with modules, check out Ansible - Getting Started with Modules.

The iptables_state module is used to save changes made to iptables. The iptables_state module is part of the community.general collection, thus you may need to use the ansible-galaxy install command to install the community.general collection.

#]$ ansible-galaxy collection install community.general
Process install dependency map
Starting collection install process
Installing 'community.general:4.0.2' to '/home/john.doe/.ansible/collections/ansible_collections/community/general'

 

In this example, iptables will be saved to the /etc/sysconfig/iptables file.

- name: save iptables
  community.general.iptables_state:
    state: saved
    path: /etc/sysconfig/iptables

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 2bc008 in the box below so that we can be sure you are a human.