68 lines
2 KiB
YAML
68 lines
2 KiB
YAML
- hosts: all
|
|
remote_user: root
|
|
tasks:
|
|
- name: install debian dependencies
|
|
package:
|
|
name: nginx,bird2
|
|
state: present
|
|
when: ansible_distribution == 'Debian'
|
|
- name: install arch dependencies
|
|
pacman:
|
|
name: nginx,bird
|
|
state: present
|
|
when: ansible_distribution == 'Archlinux'
|
|
- name: see if host0 exists / if this is a systemd-nspawn container
|
|
stat:
|
|
path: /sys/class/net/host0
|
|
register: host0
|
|
- name: configure host0
|
|
template:
|
|
src: host0-network.j2
|
|
dest: /etc/systemd/network/10-host0.network
|
|
- name: configure host0 vlan .netdev
|
|
template:
|
|
src: host0-vlan-netdev.j2
|
|
dest: /etc/systemd/network/host0-vlan.netdev
|
|
when: vlan is defined
|
|
- name: configure host0 vlan .network
|
|
template:
|
|
src: host0-vlan-network.j2
|
|
dest: /etc/systemd/network/host0-vlan.network
|
|
when: vlan is defined
|
|
- name: configure dummy interface .netdev
|
|
template:
|
|
src: dn42dummy0-netdev.j2
|
|
dest: /etc/systemd/network/dn42dummy0.netdev
|
|
- name: configure dummy interface .network
|
|
template:
|
|
src: dn42dummy0-network.j2
|
|
dest: /etc/systemd/network/dn42dummy0.network
|
|
- name: add nginx config
|
|
template:
|
|
src: nginx-global.j2
|
|
dest: /etc/nginx/nginx.conf
|
|
- name: add bird config on arch
|
|
template:
|
|
src: bird-config.j2
|
|
dest: /etc/bird.conf
|
|
when: ansible_distribution == 'Archlinux'
|
|
- name: add bird config on debian
|
|
template:
|
|
src: bird-config.j2
|
|
dest: /etc/bird/bird.conf
|
|
when: ansible_distribution == 'Debian'
|
|
- name: enable and reload/start systemd-networkd
|
|
systemd:
|
|
state: reloaded
|
|
name: systemd-networkd.service
|
|
enabled: true
|
|
- name: enable and reload/start nginx
|
|
systemd:
|
|
state: reloaded
|
|
name: nginx.service
|
|
enabled: true
|
|
- name: enable and reload/start bird
|
|
systemd:
|
|
state: reloaded
|
|
name: bird.service
|
|
enabled: true
|