ansible/roles/openvpn/tasks/main.yaml

53 lines
1.4 KiB
YAML

---
- name: gather os specific variables
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- vars
- name: include os specific tasks
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- tasks
- name: "install {{ openvpn_package_name }}"
package:
name: "{{ openvpn_package_name }}"
state: "{{ openvpn_package_state }}"
- name: "manage instances {{ item }}"
ansible.builtin.include_tasks: instances.yaml
loop: "{{ openvpn_config.keys() | list }}"
loop_control:
loop_var: instance
- name: configure IPv4 forwarding
sysctl:
name: net.ipv4.ip_forward
value: "{{ openvpn_ip_forward | default(0) }}"
sysctl_set: yes
state: present
reload: yes
- name: configure IPv6 forwarding
sysctl:
name: net.ipv6.conf.all.forwarding
value: "{{ openvpn_ip_forward | default(0) }}"
sysctl_set: yes
state: present
reload: yes