-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.yml
52 lines (40 loc) · 1.06 KB
/
site.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
# main task for role execution
- name: configure inventory hosts
hosts: localhost
gather_facts: no
vars:
linux_hosts: "{{ survey_hosts.split('\n') }}"
tasks:
- name: make host group from survey hosts list
add_host:
hostname: "{{ item }}"
groupname: new_group
loop: "{{ linux_hosts }}"
- name: download and configure openvpn client
hosts: new_group,!localhost
become: true
vars:
auth:
- "{{ auth_user }}"
- "{{ auth_pass }}"
tasks:
- name: install epel package repository
include_role:
name: install_epel
when: ansible_distribution == "CentOS" or ansible_distribution == "RedHat"
- name: install openvpn client
include_role:
name: install_openvpn
- meta: flush_handlers
# wait for new vpn connection to establish
- pause:
seconds: 15
prompt: wait for new connection to establish
# verify connection
- name: verify connection
shell: >
curl ifconfig.io/all
register: results
- debug:
msg: "{{ results.stdout_lines }}"