This repository has been archived on 2025-04-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
common-ansible/tasks/network.yml
2021-02-01 21:16:53 +01:00

28 lines
682 B
YAML

- name: check old network configuration
stat:
path: '/etc/network/interfaces'
register: old_config
- name: move old network configuration
command: 'mv /etc/network/interfaces /etc/network/interfaces.save'
when: old_config.stat.exists
- name: copy network configuration
template:
src: 'network.j2'
dest: '/etc/systemd/network/50-default.network'
owner: root
group: root
mode: '0644'
notify: restart systemd-networkd
- name: copy dns configuration
file:
src: '/run/systemd/resolve/resolv.conf'
dest: '/etc/resolv.conf'
owner: root
group: root
state: link
force: true
mode: '0644'
notify: restart systemd-resolved