ansible/roles/openvpn/tasks/main.yaml

53 lines
1.4 KiB
YAML
Raw Normal View History

2022-08-30 12:49:30 +00:00
---
- name: gather os specific variables
2022-08-31 03:19:06 +00:00
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
2022-08-30 12:49:30 +00:00
vars:
2022-08-31 03:19:06 +00:00
params:
2022-08-30 12:49:30 +00:00
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- vars
- name: include os specific tasks
2022-08-31 03:19:06 +00:00
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
2022-08-30 12:49:30 +00:00
vars:
2022-08-31 03:19:06 +00:00
params:
2022-08-30 12:49:30 +00:00
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 }}"
2022-08-31 03:19:06 +00:00
ansible.builtin.include_tasks: instances.yaml
2022-08-30 12:49:30 +00:00
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