Skip to content

Instantly share code, notes, and snippets.

@nicck
Last active March 22, 2022 22:52
Show Gist options
  • Save nicck/5554bea184aa34164b22 to your computer and use it in GitHub Desktop.
Save nicck/5554bea184aa34164b22 to your computer and use it in GitHub Desktop.

Revisions

  1. nicck revised this gist Dec 2, 2014. 2 changed files with 14 additions and 10 deletions.
    2 changes: 2 additions & 0 deletions hosts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    [vpshost]
    xxx.xxx.xx.xx
    22 changes: 12 additions & 10 deletions pptp.yml
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,20 @@
    # ansible-playbook -v -i hosts pptp.yml
    # ubuntu-14.04_32bit Server

    ---
    - hosts: atlantic
    - hosts: vpshost
    remote_user: root
    sudo: yes
    vars:
    pptp_username: box1
    pptp_password: junkfood
    pptp_username: login
    pptp_password: pswrd
    tasks:
    - name: pptpd and iptables installed
    apt: name={{ item }} state=present
    with_items:
    - pptpd
    - iptables
    # - dnsutils

    - name: local and remote ip specified in pptpd.conf
    lineinfile: dest=/etc/pptpd.conf line="{{ item }}"
    @@ -21,15 +25,13 @@
    - restart pptpd

    - name: users in chap-secrets
    lineinfile: dest=/etc/ppp/chap-secrets line="{{ username }} pptpd {{ password }} *"

    - name: dns added to pptpd-options
    lineinfile: dest=/etc/ppp/pptpd-options line="ms-dns 8.8.8.8"
    notify:
    - restart pptpd
    lineinfile: dest=/etc/ppp/chap-secrets line="{{ pptp_username }} pptpd {{ pptp_password }} *"

    - name: dns added to pptpd-options
    lineinfile: dest=/etc/ppp/pptpd-options line="ms-dns 8.8.4.4"
    lineinfile: dest=/etc/ppp/pptpd-options line="{{ item }}"
    with_items:
    - ms-dns 8.8.8.8
    - ms-dns 8.8.4.4
    notify:
    - restart pptpd

  2. nicck created this gist Oct 27, 2014.
    49 changes: 49 additions & 0 deletions pptp.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    ---
    - hosts: atlantic
    remote_user: root
    sudo: yes
    vars:
    pptp_username: box1
    pptp_password: junkfood
    tasks:
    - name: pptpd and iptables installed
    apt: name={{ item }} state=present
    with_items:
    - pptpd
    - iptables

    - name: local and remote ip specified in pptpd.conf
    lineinfile: dest=/etc/pptpd.conf line="{{ item }}"
    with_items:
    - localip 192.168.0.1
    - remoteip 192.168.0.100-200
    notify:
    - restart pptpd

    - name: users in chap-secrets
    lineinfile: dest=/etc/ppp/chap-secrets line="{{ username }} pptpd {{ password }} *"

    - name: dns added to pptpd-options
    lineinfile: dest=/etc/ppp/pptpd-options line="ms-dns 8.8.8.8"
    notify:
    - restart pptpd

    - name: dns added to pptpd-options
    lineinfile: dest=/etc/ppp/pptpd-options line="ms-dns 8.8.4.4"
    notify:
    - restart pptpd

    - name: Setup Forwarding
    sysctl: name=net.ipv4.ip_forward value=1 state=present reload=yes

    - name: NAT rule for iptables
    command: iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    notify:
    - save iptables

    handlers:
    - name: save iptables
    command: iptables-save

    - name: restart pptpd
    service: name=pptpd state=restarted