geerlingguy / ansible-role-firewall

Ansible Role - iptables Firewall configuration.
https://galaxy.ansible.com/geerlingguy/firewall/
MIT License
524 stars 217 forks source link

fatal error on "firewall: Check if ufw package is installed (on Ubuntu)." #75

Closed agajic-modoolar closed 4 years ago

agajic-modoolar commented 4 years ago

Hello,

I decided to set firewall_disable_ufw flag to disable UFW, but repeating task causes fatal error. I was wondering, could service_facts module be used to determine if ufw exists, and to disable it if so? I'm Ansible beginner, but it seems a bit ugly to have fatal fails, even though they are ignored. Am I missing something here? I'm using Ansible 2.9.7

TASK [firewall : Check if ufw package is installed (on Ubuntu).] 
....
....
....
fatal: [iaac-playground]: FAILED! => {
    "changed": false,
    "cmd": [
        "service",
        "ufw",
        "status"
    ],
    "delta": "0:00:00.019206",
    "end": "2020-04-23 20:44:32.425996",
    "invocation": {
        "module_args": {
            "_raw_params": "service ufw status",
            "_uses_shell": false,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": false
        }
    },
    "msg": "non-zero return code",
    "rc": 3,
    "start": "2020-04-23 20:44:32.406790",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "* ufw.service - Uncomplicated firewall\n   Loaded: loaded (/lib/systemd/system/ufw.service; disabled; vendor preset: enabled)\n   Active: inactive (dead)\n     Docs: man:ufw(8)\n\nApr 22 22:28:06 iaac-playgound systemd[1]: Stopping Uncomplicated firewall...\nApr 22 22:28:06 iaac-playgound ufw-init[13566]: Skip stopping firewall: ufw (not enabled)\nApr 22 22:28:06 iaac-playgound systemd[1]: Stopped Uncomplicated firewall.",
    "stdout_lines": [
        "* ufw.service - Uncomplicated firewall",
        "   Loaded: loaded (/lib/systemd/system/ufw.service; disabled; vendor preset: enabled)",
        "   Active: inactive (dead)",
        "     Docs: man:ufw(8)",
        "",
        "Apr 22 22:28:06 iaac-playgound systemd[1]: Stopping Uncomplicated firewall...",
        "Apr 22 22:28:06 iaac-playgound ufw-init[13566]: Skip stopping firewall: ufw (not enabled)",
        "Apr 22 22:28:06 iaac-playgound systemd[1]: Stopped Uncomplicated firewall."
    ]
}
...ignoring
vitabaks commented 4 years ago

Replace ignore_errors: true with failed_when: false for this task.

stale[bot] commented 4 years ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale[bot] commented 4 years ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.