浏览代码

Enable openvpn role in vagrant, plus:

* Removed unicode char from task name (ansible 1.3 doesn’t like it)
* Use ansible sysctl module instead of lineinfile
* Wait for only 5 seconds (for fully automated deploy)
Luke Cyca 11 年前
父节点
当前提交
69fc8b7eb0
共有 2 个文件被更改,包括 5 次插入7 次删除
  1. 1
    1
      Vagrantfile
  2. 4
    6
      roles/vpn/tasks/openvpn.yml

+ 1
- 1
Vagrantfile 查看文件

18
     ansible.host_key_checking = false
18
     ansible.host_key_checking = false
19
 
19
 
20
     # ansible.tags = ['blog']
20
     # ansible.tags = ['blog']
21
-    ansible.skip_tags = ['openvpn']
21
+    # ansible.skip_tags = ['openvpn']
22
     # ansible.verbose = 'vvvv'
22
     # ansible.verbose = 'vvvv'
23
 
23
 
24
     # Workaround: https://github.com/mitchellh/vagrant/issues/2174
24
     # Workaround: https://github.com/mitchellh/vagrant/issues/2174

+ 4
- 6
roles/vpn/tasks/openvpn.yml 查看文件

79
   command: openvpn --genkey --secret {{ openvpn_hmac_firewall }}
79
   command: openvpn --genkey --secret {{ openvpn_hmac_firewall }}
80
            creates={{ openvpn_hmac_firewall }}
80
            creates={{ openvpn_hmac_firewall }}
81
 
81
 
82
-- name: Generate DiffieHellman parameters (this will take a while)
82
+- name: Generate Diffie-Hellman parameters (this will take a while)
83
   command: openssl dhparam -out {{ openvpn_dhparam }} {{ openvpn_key_size }}
83
   command: openssl dhparam -out {{ openvpn_dhparam }} {{ openvpn_key_size }}
84
            creates={{ openvpn_dhparam }}
84
            creates={{ openvpn_dhparam }}
85
 
85
 
87
   copy: src=etc_rc.local dest=/etc/rc.local
87
   copy: src=etc_rc.local dest=/etc/rc.local
88
 
88
 
89
 - name: Enable IPv4 traffic forwarding
89
 - name: Enable IPv4 traffic forwarding
90
-  lineinfile: dest=/etc/sysctl.conf
91
-              regexp="^#?net.ipv4.ip_forward"
92
-              line="net.ipv4.ip_forward=1"
93
-- shell: echo 1 > /proc/sys/net/ipv4/ip_forward
90
+  sysctl: name=net.ipv4.ip_forward value=1
94
 
91
 
95
 - name: Allow OpenVPN through the firewall
92
 - name: Allow OpenVPN through the firewall
96
   command: "{{ item }}"
93
   command: "{{ item }}"
129
          dest=/tmp/sovereign-openvpn-files
126
          dest=/tmp/sovereign-openvpn-files
130
   with_items: openvpn_clients
127
   with_items: openvpn_clients
131
 
128
 
132
-- pause: prompt="You are ready to set up your OpenVPN clients. The files that you need are in /tmp/sovereign-openvpn-files. Make sure LZO compression is enabled and that you provide the ta.key file for the TLS-Auth option with a direction of '1'. Press any key to continue..."
129
+- pause: seconds=5
130
+         prompt="You are ready to set up your OpenVPN clients. The files that you need are in /tmp/sovereign-openvpn-files. Make sure LZO compression is enabled and that you provide the ta.key file for the TLS-Auth option with a direction of '1'. Press any key to continue..."

正在加载...
取消
保存