Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modprobes the interface if it does not exist after openvpn configuration #93

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,17 @@

- name: Set ip forwarding in the sysctl file and reload if necessary
sysctl: name="net.ipv4.ip_forward" value=1 sysctl_set=yes state=present reload=yes

- name: Test if interface is created
command: "ip link show {{ openvpn_dev }}0"
register: dev_created
changed_when: false
failed_when: false
- block:
- name: Enable tun0
command: "modprobe {{ openvpn_dev }} --first-time"
register: modprobe
changed_when: not modprobe.stdout.find("Module already in kernel") or modprobe.rc == 0
failed_when: not (modprobe.stdout.find("Module already in kernel") or modprobe.rc == 0)
notify: openvpn restart
when: dev_created.stdout.find("does not exist") != -1