62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
---
|
|
- name: Create interface config files
|
|
ansible.builtin.template:
|
|
src: "debian_interfaces.j2"
|
|
dest: "/etc/network/interfaces"
|
|
owner: root
|
|
group: root
|
|
mode: '644'
|
|
notify: Reload network interfaces debian
|
|
when: ansible_facts["lsb"]["id"] == "Debian"
|
|
|
|
- name: Create dhcpcd config files
|
|
ansible.builtin.template:
|
|
src: "raspbian_dhcpcd.conf.j2"
|
|
dest: "/etc/dhcpcd.conf"
|
|
owner: root
|
|
group: netdev
|
|
mode: '664'
|
|
notify: Restart dhcpcd raspbian
|
|
when: ansible_facts["lsb"]["id"] == "Raspbian"
|
|
|
|
- name: Create netplan config files
|
|
ansible.builtin.template:
|
|
src: "ubuntu_00-installer-config.yaml.j2"
|
|
dest: "/etc/netplan/00-installer-config.yaml"
|
|
owner: root
|
|
group: root
|
|
mode: '644'
|
|
notify: Apply netplan ubuntu
|
|
when: ansible_facts["lsb"]["id"] == "Ubuntu"
|
|
|
|
#- name: Install ifupdown2
|
|
# apt:
|
|
# name:
|
|
# - ifupdown2
|
|
# state: latest
|
|
# update_cache: true
|
|
# when: ansible_facts["lsb"]["id"] == "Debian"
|
|
|
|
- name: Install bridge-utils
|
|
apt:
|
|
name:
|
|
- bridge-utils
|
|
state: latest
|
|
update_cache: true
|
|
when: (ansible_facts["lsb"]["id"] == "Debian") and
|
|
(lookup('dict', interfaces, wantlist=True) | selectattr('value.bridge', 'defined') | selectattr('value.bridge') | list)
|
|
|
|
- name: Enable ipv4 forwarding
|
|
ansible.posix.sysctl:
|
|
name: net.ipv4.ip_forward
|
|
value: "'{{ ipv4_forwarding | int }}'"
|
|
sysctl_set: true
|
|
when: ipv4_forwarding
|
|
|
|
- name: Enable ipv6 forwarding
|
|
ansible.posix.sysctl:
|
|
name: net.ipv6.conf.all.forwarding
|
|
value: "'{{ ipv6_forwarding | int }}'"
|
|
sysctl_set: true
|
|
when: ipv6_forwarding
|
|
|