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