Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dan Guido 2016-08-02 21:00:27 -04:00
commit 75759a15da
5 changed files with 64 additions and 2 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@
configs/*.mobileconfig
configs/*.p12
configs/*.crt
configs/*.tmp
inventory_users

View File

@ -11,7 +11,10 @@ easyrsa_reinit_existent: True
dns_servers:
- 8.8.8.8
- 8.8.4.4
- 2001:4860:4860::8888
- 2001:4860:4860::8844
vpn_network: 10.19.48.0/24
vpn_network_ipv6: fd9d:bc11:4021:69ce::/64
server_name: "{{ ansible_ssh_host }}"
users:

View File

@ -84,4 +84,55 @@
- name: Wait for SSH to become available
local_action: "wait_for port=22 host={{ do.droplet.ip_address }} timeout=320"
- name: Enable IPv6 on the droplet
uri:
url: "https://api.digitalocean.com/v2/droplets/{{ do.droplet.id }}/actions"
method: POST
body:
type: enable_ipv6
body_format: json
status_code: 201
HEADER_Authorization: "Bearer {{ do_access_token }}"
HEADER_Content-Type: "application/json"
- name: Get Droplet networks
uri:
url: "https://api.digitalocean.com/v2/droplets/{{ do.droplet.id }}"
method: GET
status_code: 200
HEADER_Authorization: "Bearer {{ do_access_token }}"
HEADER_Content-Type: "application/json"
register: droplet_info
- name: IPv6 template created
template: src=20-ipv6.cfg.j2 dest=configs/20-ipv6.tmp
with_items: "{{ droplet_info.json.droplet.networks.v6 }}"
- name: Post-provisioning tasks
hosts: vpn-host
gather_facts: false
user: root
vars_files:
- config.cfg
pre_tasks:
- name: Install prerequisites
raw: sudo apt-get update -qq && sudo apt-get install -qq -y python2.7
- name: Configure defaults
raw: sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
tasks:
- name: IPv6 configured
copy: src=configs/20-ipv6.tmp dest=/etc/network/interfaces.d/20-ipv6.cfg owner=root group=root mode=0644
- name: IPv6 included into the network config
lineinfile: dest=/etc/network/interfaces line='source /etc/network/interfaces.d/20-ipv6.cfg' state=present
- name: IPV6 is running
shell: sh -c 'ifdown eth0; ip addr flush dev eth0; ifup eth0'
- name: Wait for SSH to become available
local_action: "wait_for port=22 host={{ inventory_hostname }} timeout=320"
become: false

6
templates/20-ipv6.cfg.j2 Normal file
View File

@ -0,0 +1,6 @@
iface eth0 inet6 static
address {{ item.ip_address }}
netmask {{ item.netmask }}
gateway {{ item.gateway }}
autoconf 0
dns-nameservers 2001:4860:4860::8844 2001:4860:4860::8888

View File

@ -22,7 +22,7 @@ conn %default
right=%any
rightauth=pubkey
rightsourceip="{{ vpn_network }}"
rightsourceip={{ vpn_network }},{{ vpn_network_ipv6 }}
{% if service_dns is defined and service_dns == "N" %}
rightdns={% for host in dns_servers %}{{ host }}{% if not loop.last %},{% endif %}{% endfor %}
{% else %}