clarified some defaults, updated readme

This commit is contained in:
Bertrand Lanson 2023-04-11 23:56:27 +02:00
parent 9d7877c909
commit 9c13397c64
3 changed files with 53 additions and 18 deletions

View File

@ -1,38 +1,76 @@
Role Name
Manage netplan
=========
> This repository is only a mirror. Development and testing is done on a private gitlab server.
A brief description of the role goes here.
This role install and configure network interfaces using netplan for **debian-based** distributions.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
None.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Available variables are listed below, along with default values. A sample file for the default values is available in `default/hashicorp_consul.yml.sample` in case you need it for any `group_vars` or `host_vars` configuration.
```yaml
manage_netplan_config_file: /etc/netplan/ansible-config.yaml # by default, set to /etc/netplan/ansible-config.yaml
```
This variable defines the path and file name that'll be used to copy over the netplan configuration.
```yaml
manage_netplan_renderer: networkd # by default, set to networkd
```
This variable defines the renderer that'll be used by netplan. Defaults to `networkd`, but `NetworkManager` is also an option.
```yaml
manage_netplan_remove_existing: false # by default, set to false
```
This variable defines whether or not to remove all existing netplan configuration when applying the new one. Defaults to `false`.
```yaml
manage_netplan_search_domain: example.org #by default, set to example.org
```
This variable defines the search domain to use in case you want to specify dns resolution inside of your netplan configuration. This can be left untouched if you do not intend to use it.
```yaml
manage_netplan_install: true # by default, set to true
```
This variable defines whether or not to install netplan and related packages when running this role. It is recommended to not change it to ensure that netplan and eventually NetworkManager are installed. If you are already making sure that these packages are installed elsewhere, you can set this to `false`.
```yaml
manage_netplan_apply: true # by default, set to true
```
This variable defines whether or not to apply the netplan configuration once it has been written to the target system. Defaults to `true`.
```yaml
manage_netplan_configuration: {} # by default, set to {}
```
This variable contains the content of your netplan file in yml format. This what will be used to generate the configuration file on the target host.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
This role has a task that installs its own dependencies located in `task/prerequisites.yml`, so that you don't need to manage them. This role requires `ednxzu.manage_apt_packages` to install netplan and eventually network-manager if needed.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
```yaml
# calling the role inside a playbook with either the default or group_vars/host_vars
- hosts: servers
roles:
- ednxzu.manage_netplan
```
License
-------
BSD
MIT / BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
This role was created by Bertrand Lanson in 2023.

View File

@ -3,13 +3,10 @@
manage_netplan_config_file: /etc/netplan/ansible-config.yaml # this MUST be .yaml, .yml will not be picked up by netplan
manage_netplan_renderer: networkd # supported value is 'NetworkManager' or 'networkd'
manage_netplan_remove_existing: false
manage_netplan_packages:
- netplan.io
manage_netplan_search_domain: example.org
manage_netplan_check_install: true
manage_netplan_install: true
manage_netplan_apply: true
manage_netplan_configuration:
{}
manage_netplan_configuration: {}
# network:
# version: 2
# ethernets:

View File

@ -10,4 +10,4 @@
backup: true
when: manage_netplan_configuration != []
notify:
- "Generate netplan configuration"
- "netplan-generate"