Skip to content

Instantly share code, notes, and snippets.

@cyriac
Created February 25, 2015 09:13
Show Gist options
  • Save cyriac/67bdcea3a09140c96d22 to your computer and use it in GitHub Desktop.
Save cyriac/67bdcea3a09140c96d22 to your computer and use it in GitHub Desktop.
PPTP VPN setup - ansible
---
- hosts: all
sudo: yes
tasks:
- name: set hostname using hostname command
command: hostname {{ inventory_hostname }}
- name: set hostname in /etc/hostname
shell: echo {{ inventory_hostname }} > /etc/hostname
- name: Set ip_forward (ipv4)
sysctl: name="net.ipv4.ip_forward" value=1 sysctl_set=yes state=present reload=yes
- name: Set ip_forward (ipv6)
sysctl: name="net.ipv6.conf.all.forwarding" value=1 sysctl_set=yes state=present reload=yes
- name: Install pptp
apt: pkg=pptpd
- name: Adding internal routing IPs (localip)
lineinfile: dest=/etc/pptpd.conf line="localip 10.99.99.99"
- name: Adding internal routing IPs (remoteip)
lineinfile: dest=/etc/pptpd.conf line="remoteip 10.99.99.100-199"
- name: Adding sample access credentials
lineinfile: dest=/etc/ppp/chap-secrets line="#<username> pptpd <password> *"
- name: Adding masquerade config to rc.local
lineinfile: dest=/etc/rc.local line="iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE"
- name: Executing iptables update
command: iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment