mirror of
https://gitea.0xace.cc/ansible-galaxy/bird.git
synced 2025-06-29 02:23:08 +00:00
rework bird role and add debian support
This commit is contained in:
49
tasks/Debian/main.yaml
Normal file
49
tasks/Debian/main.yaml
Normal file
@ -0,0 +1,49 @@
|
||||
---
|
||||
- name: Mask bird before install for Debian OS family
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ bird_unit_name }}"
|
||||
masked: yes
|
||||
when: ansible_facts['os_family'] == 'Debian'
|
||||
changed_when: false
|
||||
|
||||
- name: Install bird
|
||||
package:
|
||||
name: "{{ bird_package }}"
|
||||
state: present
|
||||
register: bird_setup
|
||||
|
||||
- name: Template default bird.conf config
|
||||
when: bird_config_override is not defined
|
||||
block:
|
||||
- name: Add default bird.conf
|
||||
template:
|
||||
src: "bird.conf.j2"
|
||||
dest: "/etc/bird/bird.conf"
|
||||
notify:
|
||||
- Reload bird
|
||||
|
||||
- name: Template bird.conf override
|
||||
when: bird_config_override is defined
|
||||
block:
|
||||
- name: Override bird.conf
|
||||
copy:
|
||||
content: "{{ bird_config_override }}"
|
||||
dest: "/etc/bird/bird.conf"
|
||||
notify:
|
||||
- Reload bird
|
||||
|
||||
- name: Unmask bird after install for Debian OS family
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ bird_unit_name }}"
|
||||
masked: no
|
||||
when: ansible_facts['os_family'] == 'Debian'
|
||||
changed_when: false
|
||||
|
||||
- name: Enable and start bird service
|
||||
systemd:
|
||||
name: "{{ bird_unit_name }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
masked: no
|
||||
daemon_reload: yes
|
||||
register: bird_enable_and_start
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
- name: Install BIRD
|
||||
package:
|
||||
name: bird2
|
||||
state: present
|
||||
|
||||
- name: Add BIRD config
|
||||
template:
|
||||
src: bird.conf.j2
|
||||
dest: /etc/bird.conf
|
||||
notify:
|
||||
- Reload BIRD
|
||||
|
||||
- name: Start BIRD service
|
||||
systemd:
|
||||
name: bird
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
@ -1,19 +0,0 @@
|
||||
---
|
||||
- name: Install BIRD
|
||||
package:
|
||||
name: bird
|
||||
state: present
|
||||
|
||||
- name: Add BIRD config
|
||||
template:
|
||||
src: bird.conf.j2
|
||||
dest: /etc/bird.conf
|
||||
notify:
|
||||
- Reload BIRD
|
||||
|
||||
- name: Start BIRD service
|
||||
systemd:
|
||||
name: bird
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
42
tasks/RedHat/main.yaml
Normal file
42
tasks/RedHat/main.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
- name: Install bird
|
||||
package:
|
||||
name: "{{ bird_package }}"
|
||||
state: present
|
||||
register: bird_setup
|
||||
|
||||
- name: Add bird.conf
|
||||
template:
|
||||
src: bird.conf.j2
|
||||
dest: /etc/bird.conf
|
||||
notify:
|
||||
- Reload bird
|
||||
|
||||
- name: Template default bird.conf config
|
||||
when: bird_config_override is not defined
|
||||
block:
|
||||
- name: Add bird.conf
|
||||
template:
|
||||
src: "bird.conf.j2"
|
||||
dest: "/etc/bird.conf"
|
||||
notify:
|
||||
- Reload bird
|
||||
|
||||
- name: Template bird.conf override
|
||||
when: bird_config_override is defined
|
||||
block:
|
||||
- name: Override bird.conf
|
||||
copy:
|
||||
content: "{{ bird_config_override }}"
|
||||
dest: "/etc/bird.conf"
|
||||
notify:
|
||||
- Reload bird
|
||||
|
||||
- name: Enable and start bird service
|
||||
systemd:
|
||||
name: "{{ bird_unit_name }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
masked: no
|
||||
daemon_reload: yes
|
||||
register: bird_enable_and_start
|
@ -1,3 +1,18 @@
|
||||
---
|
||||
- name: Include BIRD installation tasks
|
||||
include_tasks: "{{ ansible_facts['os_family'] }}/{{ ansible_facts['distribution_major_version'] }}.yaml"
|
||||
- name: Load a variable file based on the OS type
|
||||
include_vars: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
||||
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
||||
- "{{ ansible_facts['distribution'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}.yaml"
|
||||
paths:
|
||||
- "vars"
|
||||
tags: bird_vars
|
||||
|
||||
- name: Include bird installation tasks
|
||||
include_tasks: "{{ ansible_facts['os_family'] }}/main.yaml"
|
||||
|
Reference in New Issue
Block a user