ganeti-ansible/roles/node/tasks/network.yml

70 lines
1.8 KiB
YAML
Raw Permalink Normal View History

2024-11-26 14:56:58 +00:00
- name: Check if default interface is configured
ansible.builtin.set_fact:
interface_configured: "{{ interface_name in ansible_interfaces }}"
- name: Check if bridge is configured
ansible.builtin.set_fact:
bridge_configured: "{{ bridge_name in ansible_interfaces }}"
- name: Configure default interface name
ansible.builtin.template:
src: etc-systemd-network-10-lan0.link.j2
dest: /etc/systemd/network/10-{{ interface_name }}.link
mode: "0644"
when: not interface_configured
notify:
- update initramfs
- reboot
- name: Create bridge interface
ansible.builtin.template:
src: etc-systemd-network-20-xenbr0.netdev.j2
dest: /etc/systemd/network/20-{{ bridge_name }}.netdev
mode: "0644"
when: not bridge_configured
notify:
- update initramfs
- reboot
- name: Configure bridge interface
ansible.builtin.template:
src: etc-systemd-network-30-xenbr0.link.j2
dest: /etc/systemd/network/30-{{ bridge_name }}.link
mode: "0644"
when: not bridge_configured
notify:
- update initramfs
- reboot
- name: Create bridge network
ansible.builtin.template:
src: etc-systemd-network-40-xenbr0.network.j2
dest: /etc/systemd/network/40-{{ bridge_name }}.network
mode: "0644"
when: not bridge_configured
notify:
- update initramfs
- reboot
- name: Configure network for default interface
ansible.builtin.template:
src: etc-systemd-network-50-lan0.network.j2
dest: /etc/systemd/network/50-{{ interface_name }}.network
mode: "0644"
when: not interface_configured
notify:
- update initramfs
- reboot
- name: Enable systemd-networkd
ansible.builtin.systemd_service:
name: systemd-networkd
enabled: true
state: restarted
- name: Enable systemd-resolved
ansible.builtin.systemd_service:
name: systemd-resolved
enabled: true
state: restarted