WIP. различная обработка типов
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
# defaults file for network-manager
|
# defaults file for network-manager
|
||||||
nm_version: =1.42.*
|
nm_version: =1.42.*
|
||||||
|
nm__skip_install: false
|
||||||
# force to configure conf.d/10-globally-managed-devices.conf
|
# force to configure conf.d/10-globally-managed-devices.conf
|
||||||
globally_managed_devices: true
|
globally_managed_devices: true
|
||||||
globally_managed_devices_path: "/etc/NetworkManager/conf.d/10-globally-managed-devices.conf"
|
globally_managed_devices_path: "/etc/NetworkManager/conf.d/10-globally-managed-devices.conf"
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
---
|
---
|
||||||
# tasks file for network-manager
|
# tasks file for network-manager
|
||||||
- name: "apt install NetworkManager {{ nm_version }} "
|
- name: "apt install NetworkManager {{ nm_version }} "
|
||||||
|
when: nm__skip_install is not true
|
||||||
apt:
|
apt:
|
||||||
name: "network-manager{{ nm_version }}"
|
name: "network-manager{{ nm_version }}"
|
||||||
default_release: "{{ ansible_distribution_release }}-backports"
|
default_release: "{{ ansible_distribution_release }}-backports"
|
||||||
autoremove: true
|
autoremove: true
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Enable service NetworkManager and ensure it is not masked
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: NetworkManager
|
||||||
|
enabled: true
|
||||||
|
masked: no
|
||||||
|
|
||||||
- name: config globally managed devices
|
- name: config globally managed devices
|
||||||
template:
|
template:
|
||||||
src: "conf.d/10-globally-managed-devices.j2"
|
src: "conf.d/10-globally-managed-devices.j2"
|
||||||
@@ -15,6 +22,7 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: globally_managed_devices is true
|
when: globally_managed_devices is true
|
||||||
|
notify: Restart NetworkManager
|
||||||
|
|
||||||
- name: cleanup globally managed devices
|
- name: cleanup globally managed devices
|
||||||
file:
|
file:
|
||||||
@@ -26,7 +34,24 @@
|
|||||||
- name: Include tasks for checking and removing udev rules
|
- name: Include tasks for checking and removing udev rules
|
||||||
include_tasks: check_udev_rules.yml
|
include_tasks: check_udev_rules.yml
|
||||||
|
|
||||||
- name: Configure NetworkManager
|
- name: Configure NetworkManager [ type loopback ]
|
||||||
|
community.general.nmcli:
|
||||||
|
autoconnect: "{{ connection.autoconnect | default('true') }}"
|
||||||
|
conn_name: "{{ connection.con_name | default('lo') }}"
|
||||||
|
ifname: "{{ connection.ifname | default('lo') }}"
|
||||||
|
type: "{{ connection.type }}"
|
||||||
|
ip4: "{{ connection.ip4 | default('') }}"
|
||||||
|
dns4: "{{ connection.dns4 | default([]) }}"
|
||||||
|
method4: "{{ connection.method4 | default('manual') }}"
|
||||||
|
method6: "{{ connection.method6 | default('auto') }}"
|
||||||
|
state: present
|
||||||
|
with_items: "{{ network }}"
|
||||||
|
when: connection.type == 'loopback'
|
||||||
|
loop_control:
|
||||||
|
loop_var: connection
|
||||||
|
notify: Restart NetworkManager
|
||||||
|
|
||||||
|
- name: Configure NetworkManager [ type ethernet ]
|
||||||
community.general.nmcli:
|
community.general.nmcli:
|
||||||
autoconnect: "{{ connection.autoconnect | default('true') }}"
|
autoconnect: "{{ connection.autoconnect | default('true') }}"
|
||||||
conn_name: "{{ connection.con_name }}"
|
conn_name: "{{ connection.con_name }}"
|
||||||
@@ -37,9 +62,10 @@
|
|||||||
dns4: "{{ connection.dns4 | default([]) }}"
|
dns4: "{{ connection.dns4 | default([]) }}"
|
||||||
routes4: "{{ connection.routes4 | default([]) }}"
|
routes4: "{{ connection.routes4 | default([]) }}"
|
||||||
method4: "{{ connection.method4 | default('manual') }}"
|
method4: "{{ connection.method4 | default('manual') }}"
|
||||||
method6: "{{ connection.method6 | default('auto') }}"
|
method6: "{{ connection.method6 | default('disabled') }}"
|
||||||
state: present
|
state: present
|
||||||
with_items: "{{ network }}"
|
with_items: "{{ network }}"
|
||||||
|
when: connection.type == 'ethernet'
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: connection
|
loop_var: connection
|
||||||
notify: Restart NetworkManager
|
notify: Restart NetworkManager
|
||||||
|
|||||||
Reference in New Issue
Block a user