Skip to content

ansibleguy/collection_nftables

Repository files navigation

Ansible Collection - ansibleguy.nftables

Buy me a coffee

Ansible Galaxy Docs

Functional Test Status Unit Tests YamlLint Test Status PyLint Test Status Ansible-Lint Test Status

Functional Test Logs: Short, Full


Usage

See: Docs

You want a simple Ansible GUI? Check-out my Ansible WebUI


Contribute

Feel free to contribute to this project using pull-requests, issues and discussions!

See also: Contributing


Advertisement

  • Need professional support using Ansible or NFTables? Contact us:

    E-Mail: contact@oxl.at

    Tel: +43 3115 40 900 0

    Web: EN | DE

    Language: German or English

  • You want a simple Ansible GUI?

    Check-out this Ansible WebUI


Modules

not implemented => development => testing => unstable (practical testing) => stable

Function Module Usage State
Listing ansibleguy.nftables.list Docs testing
Rules ansibleguy.nftables.rule Docs, NFTables Docs development
1-to-1 Rules ansibleguy.nftables.rule_raw Docs, NFTables Docs testing
Chains ansibleguy.nftables.chain Docs, NFTables Docs testing
Tables ansibleguy.nftables.table Docs, NFTables Docs testing
Variables ansibleguy.nftables.var Docs, NFTables Docs not implemented
Sets ansibleguy.nftables.set Docs, NFTables Docs not implemented
Limits ansibleguy.nftables.limit Docs, NFTables Docs not implemented
Counters ansibleguy.nftables.counter Docs, NFTables Docs not implemented

Requirements

First - install nftables!

For the python library to work the installed NFTables version needs to be >= 0.9.3

sudo apt install nftables

# check the installed version
sudo apt policy nftables

The ansible-modules of this collection use the python3-nftables module to interact with nftables.

You can either install it using your package manager (apt in the example) or using pip (unofficial version provided by AnsibleGuy) on the target system.

# package manager
sudo apt install python3-nftables

# pip => make sure it is installed for the root user or use a virtualenv
sudo pip install ansibleguy-nftables

You might want to install it using Ansible:

- name: Installing NFTables
  ansible.builtin.package:
    name: ['nftables']  # or ['nftables', 'python3-nftables']

- name: Installing NFTables python-module
  ansible.builtin.pip:
    name: 'ansibleguy-nftables'

- name: Enabling and starting NFTables
  ansible.builtin.service:
    name: 'nftables.service'
    state: started
    enabled: true

Then - install the collection itself: (on the controller)

# unstable/latest version:
ansible-galaxy collection install ansibleguy.nftables
## OR
ansible-galaxy collection install git+https://github.com/ansibleguy/collection_nftables.git

# install to specific director for easier development
cd $PLAYBOOK_DIR
ansible-galaxy collection install git+https://github.com/ansibleguy/collection_nftables.git -p ./collections