Skip to content
Snippets Groups Projects
Commit e2224bc4 authored by Kamil Andoniadis's avatar Kamil Andoniadis
Browse files

Resolve "Prepare role for using with Ansible Galaxy"

parent 097526c8
No related branches found
No related tags found
No related merge requests found
# Ansible role - Interface - BETA (only for Ansible 2.3.3.0)
# Ansible role - Interface (only for Ansible 2.3.3.0)
This role serves for network interface configuration on debian-based systems.
......@@ -19,22 +19,22 @@ This role serves for network interface configuration on debian-based systems.
Mandatory parameters.
* `interface_interfaces` - The list of network interface parameters. Each interface may consists of following attributes.
* `interface_mac` (mandatory) - .
* `interface_default_gateway` (optional) - .
* `interface_mac` (mandatory) - The MAC address of interface to configure.
* `interface_default_gateway` (optional) - The IPv4 address of default gateway.
* `interface_routes` (optional) - The list of route parameters. Each route must consist of following attributes.
* `gateway` (mandatory) - .
* `network` (mandatory) - .
* `mask` (mandatory) - .
* `gateway` (mandatory) - The IPv4 address of default gateway for this route.
* `network` (mandatory) - The IP address of network from which pakets will be routed.
* `mask` (mandatory) - The subnet mask in address format or prefix number.
Optional parameters.
* `interface_clean` - .
* `interface_mtu` - .
* `interface_file_name` - .
* `interface_clean` - Boolean value (**True**/**False**) that means whether to clean all interface configuration before applying role or not.
* `interface_mtu` - The number of maximum transmission unit.
* `interface_file_name` - The file name for your configuration located in `/etc/network/interfaces.d/` directory.
## Example
Example of the simplest network interface configuration that
Example of the simplest network interface configuration that just set MTU of specified interface.
```yml
roles:
......
......@@ -2,7 +2,12 @@
interface_default_file: /etc/network/interfaces
interface_directory: '{{ interface_default_file }}.d'
interface_file_name:
interface_file: '{% if interface_file_name is defined and interface_file_name %}{{ interface_directory }}/{{ interface_file_name }}{% else %}{{ interface_default_file }}{% endif %}'
interface_file: '
{%- if interface_file_name is defined and interface_file_name -%}
{{ interface_directory }}/{{ interface_file_name }}
{%- else -%}
{{ interface_default_file }}
{%- endif %}'
interface_clean: True
interface_mtu: 1442
......
dependencies:
- src: git@gitlab.ics.muni.cz:CSIRT-MU-public/ansible-roles/common.git
scm: git
galaxy_info:
role_name: interface
author: Kamil Andoniadis
description: Basic network interface configuration
licence: MIT
min_ansible_version: 2.3.3
platforms:
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- all
......@@ -5,7 +5,7 @@
when: not interface_mac
- set_fact:
interface_device: '{%- from "templates/network.j2" import mac_to_interface with context -%}
interface_device: '{%- from "roles/common/templates/network.j2" import mac_to_interface with context -%}
{{ mac_to_interface(interface_mac) | default("") }}'
- include: clean.yml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment