Nordeus/ansible_iptables_raw

/etc/iptables/rules.v4 - no such file or directory

Closed this issue · 9 comments

added the following tasks to fix:

  • file: path=/etc/iptables owner=root group=root state=directory

  • file: path=/etc/iptables/rules.v4 owner=root group=root state=touch

The module should create all the needed directories and files automatically, so it's strange that you have this issues.

Could you please tell me a few more details, since I can't reproduce this bug without it:

  • Which distribution are you using on the control and on the managed host?
  • Provide an example playbook which causes this issue?
  • How do you run the playbook (which remote user are you using, do you use sudo, etc)
  • Output of the actual error generated by Ansible

control - macOS Sierra
managed host - Ubuntu 12.04 on AWS
remote user - ubuntu
sudo - yes

Output of the actual error generated by Ansible

TASK [lmb.jenkins : iptables_raw] **********************************************
failed: ec2-52-48-141-50.eu-west-1.compute.amazonaws.com => {"failed": true, "item": 80, "msg": "Could not replace file: /tmp/tmpRj_rbT to /etc/iptables/rules.v4: [Errno 2] No such file or directory"}
failed: ec2-52-48-141-50.eu-west-1.compute.amazonaws.com => {"failed": true, "item": "8080", "msg": "Could not replace file: /tmp/tmpYbVrvb to /etc/iptables/rules.v4: [Errno 2] No such file or directory"}

5nafu commented

Hi,

I can confirm the issue on an upstream debian-jessie (tested with vagrant). Please see the pull request #11 for reproducability.

@5nafu I will try it out. Thanks for providing a test playbook.

5nafu commented

I just found out, the /etc/iptables/ directory comes from the package iptables-persistent.

Maybe iptables_raw should install it?

The documentation says that you need to have it installed on Debian. Maybe we could install it.

5nafu commented

@kustodian , @lioramilbaum : Would you consider moving part of the documentation as fix for this issue?

Closing this because it should be resolved with #12