Skip to content

markahesketh/ansible-role-ufw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Role: UFW

Build Status

Ansible role to manage UFW (Uncomplicated Firewall), a firewall configuration tool for Ubuntu/Debian systems.

Installation

ansible-galaxy install markahesketh.ufw

Role Variables

Default values are listed below (see defaults/main.yml):

ufw_default_policy: deny

ufw_rules:
  - to_port: 22
    rule: limit
  - to_port: 80
    rule: allow
  - to_port: 443
    rule: allow

The ufw_rules variable is an array of objects, with the following options from the UFW module:

ufw_rules:
  - to_port:
    rule:
    proto:
    to_ip:
    from_port:
    from_ip:
    interface:
    direction:
    log:

You can specify the firewall's default policy with the ufw_default_policy variable, which accepts allow, deny and reject as options.

ufw_default_policy: "allow|deny|reject"

Dependencies

None.

Example Playbook

- hosts: web
  roles:
    - markahesketh.ufw

Testing

molecule test

Requires Molecule and Docker.

License

This role is open-sourced software licensed under the MIT license.

Author

By Mark Hesketh, a web developer from Manchester, UK.