dn42-ansible/lg.yml

62 lines
2.2 KiB
YAML

- name: Configure bird-lg-go on routers
hosts: routers
remote_user: root
tasks:
- name: Build looking glass destinations list
ansible.builtin.shell: echo {% for host in ansible_play_hosts %}{{ hostvars[host]['unicastv6'] }},{% endfor %}|sed 's/,$//'
register: lg_dests
run_once: true
delegate_to: 127.0.0.1
- name: Add Debian build dependencies
ansible.builtin.package:
name: make,git,golang-1.23
state: present
when: ansible_distribution == 'Debian'
- name: Make debian sane
ansible.builtin.file:
state: link
dest: /usr/local/bin/go
src: /usr/lib/go-1.23/bin/go
when: ansible_distribution == 'Debian'
- name: Add Arch build dependencies
ansible.builtin.pacman:
name: base-devel,go
state: present
when: ansible_distribution == 'Archlinux'
- name: Make bird-lg-go directory in /opt
ansible.builtin.file:
dest: /opt/bird-lg-go
state: directory
- name: Download bird-lg-go
ansible.builtin.git:
repo: https://github.com/xddxdd/bird-lg-go
dest: /opt/bird-lg-go/src
- name: Build bird-lg-go
ansible.builtin.make:
chdir: /opt/bird-lg-go/src
- name: Create proxy systemd service
ansible.builtin.template:
src: lg/proxy-service.j2
dest: /etc/systemd/system/bird-lg-go-proxy.service
mode: '0644'
when: ansible_service_mgr == 'systemd'
- name: Enable and start/reload bird-lg-go-proxy
ansible.builtin.systemd_service:
name: bird-lg-go-proxy.service
enabled: true
state: restarted
daemon_reload: true
when: ansible_service_mgr == 'systemd'
- name: Create frontend systemd service
ansible.builtin.template:
src: lg/frontend-service.j2
dest: /etc/systemd/system/bird-lg-go-frontend.service
mode: '0644'
when: ansible_service_mgr == 'systemd'
- name: Enable and start/reload bird-lg-go-frontend
ansible.builtin.systemd_service:
name: bird-lg-go-frontend.service
enabled: true
state: restarted
daemon_reload: true
when: ansible_service_mgr == 'systemd'