# Failed : Testing IPtables rules with Molecules

**URL:** <https://forum.ansible.com/t/failed-testing-iptables-rules-with-molecules/36365>\
**Category:** Ansible Project\
**Created:** [February 24, 2022, 12:22pm UTC](https://forum.ansible.com/t/failed-testing-iptables-rules-with-molecules/36365 "2022-02-24T12:22:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![selvigp](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/selvigp/32/4977_2.png) [@selvigp](https://forum.ansible.com/u/selvigp)\
**Post date:** [February 24, 2022, 12:22pm UTC](https://forum.ansible.com/t/failed-testing-iptables-rules-with-molecules/36365/1 "2022-02-24T12:22:29Z")

</div>

Hi,

I have created iptables ansible roles, which contain rules such as Alias port and Masquerade traffic. I am using molecule to test this role. But whenever I give empty values for those rules, it is working fine. In the scenario, if I pass value to the variables assigned to those rules. I am getting different types of errors. I am testing with docker drivers. For eg., if I give molecule converge

Output look like this

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [February 24, 2022, 12:36pm UTC](https://forum.ansible.com/t/failed-testing-iptables-rules-with-molecules/36365/2 "2022-02-24T12:36:10Z")

</div>

Hi Selvi,

Can you please provide content of `/twmn/ansible/collections/ansible_collections/twmn/twmn/roles/iptables/tasks/rules.yml` ? The error suggests that you have not defined `interfaces` variable which is required. It is difficult to answer your question without looking at the role.

Thanks,  
Abhijeet

---

<div class="post-metadata">

**Author:** ![selvigp](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/selvigp/32/4977_2.png) [@selvigp](https://forum.ansible.com/u/selvigp)\
**Post date:** [February 27, 2022, 12:04pm UTC](https://forum.ansible.com/t/failed-testing-iptables-rules-with-molecules/36365/3 "2022-02-27T12:04:32Z")

</div>

Hey Abijeet,

Thanks for your reply. Now, I have resolved those issues. But I am still looking for information about how to write test cases in molecule to test the tables alias port and masquerade rules. Molecule converge is working fine, is it possible to do verify those scenarios in Test infra.

Thanks  
Selvi
