# Modifying Iptables With Ansible

**URL:** <https://forum.ansible.com/t/modifying-iptables-with-ansible/25548>\
**Category:** Ansible Developer\
**Created:** [September 21, 2017, 5:37am UTC](https://forum.ansible.com/t/modifying-iptables-with-ansible/25548 "2017-09-21T05:37:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![himanshu.rajput](https://avatars.discourse-cdn.com/v4/letter/h/779978/32.png) [@himanshu.rajput](https://forum.ansible.com/u/himanshu.rajput)\
**Post date:** [September 21, 2017, 5:37am UTC](https://forum.ansible.com/t/modifying-iptables-with-ansible/25548/1 "2017-09-21T05:37:36Z")

</div>

Hi,

Can anyone help me with implementing iptables with Ansible? I want my server to be accessible only from specific IP addresses. I want to drop all the traffic except coming from several nodes. Should I drop all traffic and then add some rule?  
Kindly Help if anyone can?

---

<div class="post-metadata">

**Author:** ![Adam\_Lemanski](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Adam\_Lemanski](https://forum.ansible.com/u/Adam_Lemanski)\
**Post date:** [September 25, 2017, 9:23am UTC](https://forum.ansible.com/t/modifying-iptables-with-ansible/25548/2 "2017-09-25T09:23:11Z")

</div>

Hi,

there are tons of iptables roles in ansible galaxy, this one looks quite nice: [https://galaxy.ansible.com/hispanico/iptables/](https://galaxy.ansible.com/hispanico/iptables/)
