2016-07-27 21:27:11 +00:00
|
|
|
---
|
|
|
|
|
2016-08-11 20:54:29 +00:00
|
|
|
- hosts: localhost
|
|
|
|
gather_facts: False
|
2017-05-08 20:34:45 +00:00
|
|
|
tags: always
|
2016-08-11 20:54:29 +00:00
|
|
|
vars_files:
|
2016-08-16 03:32:44 +00:00
|
|
|
- config.cfg
|
2016-12-15 10:33:29 +00:00
|
|
|
|
2016-08-11 20:54:29 +00:00
|
|
|
tasks:
|
2017-04-29 14:48:25 +00:00
|
|
|
- block:
|
|
|
|
- name: Add the server to the vpn-host group
|
|
|
|
add_host:
|
|
|
|
hostname: "{{ server_ip }}"
|
|
|
|
groupname: vpn-host
|
|
|
|
ansible_ssh_user: "{{ server_user }}"
|
|
|
|
ansible_python_interpreter: "/usr/bin/python2.7"
|
|
|
|
ssh_tunneling_enabled: "{{ ssh_tunneling_enabled }}"
|
|
|
|
easyrsa_CA_password: "{{ easyrsa_CA_password }}"
|
2017-06-08 14:27:35 +00:00
|
|
|
IP_subject: "{{ IP_subject_alt_name }}"
|
2017-04-29 14:48:25 +00:00
|
|
|
ansible_ssh_private_key_file: "{{ SSH_keys.private }}"
|
|
|
|
|
|
|
|
- name: Wait until SSH becomes ready...
|
|
|
|
local_action:
|
|
|
|
module: wait_for
|
|
|
|
port: 22
|
|
|
|
host: "{{ server_ip }}"
|
|
|
|
search_regex: "OpenSSH"
|
|
|
|
delay: 10
|
|
|
|
timeout: 320
|
|
|
|
state: present
|
|
|
|
become: false
|
|
|
|
rescue:
|
|
|
|
- debug: var=fail_hint
|
|
|
|
tags: always
|
|
|
|
- fail:
|
|
|
|
tags: always
|
2016-08-11 20:54:29 +00:00
|
|
|
|
2016-07-30 17:26:30 +00:00
|
|
|
- name: User management
|
2016-08-11 20:54:29 +00:00
|
|
|
hosts: vpn-host
|
2017-02-03 19:24:02 +00:00
|
|
|
gather_facts: true
|
2016-07-30 16:05:04 +00:00
|
|
|
become: true
|
2016-07-27 21:27:11 +00:00
|
|
|
vars_files:
|
2016-08-16 03:32:44 +00:00
|
|
|
- config.cfg
|
2016-08-25 20:59:16 +00:00
|
|
|
|
2016-08-18 18:49:20 +00:00
|
|
|
pre_tasks:
|
2017-04-29 14:48:25 +00:00
|
|
|
- block:
|
|
|
|
- name: Common pre-tasks
|
2018-03-02 12:55:54 +00:00
|
|
|
include_tasks: playbooks/common.yml
|
2017-05-08 20:34:45 +00:00
|
|
|
tags: always
|
2017-04-29 14:48:25 +00:00
|
|
|
rescue:
|
|
|
|
- debug: var=fail_hint
|
|
|
|
tags: always
|
|
|
|
- fail:
|
|
|
|
tags: always
|
2017-03-18 09:22:07 +00:00
|
|
|
|
2016-10-06 17:39:53 +00:00
|
|
|
roles:
|
2017-05-08 20:34:45 +00:00
|
|
|
- { role: ssh_tunneling, tags: always, when: ssh_tunneling_enabled is defined and ssh_tunneling_enabled == "y" }
|
|
|
|
- { role: vpn }
|
2016-10-06 17:39:53 +00:00
|
|
|
|
2016-12-14 15:49:47 +00:00
|
|
|
post_tasks:
|
2017-04-29 14:48:25 +00:00
|
|
|
- block:
|
|
|
|
- debug:
|
|
|
|
msg:
|
|
|
|
- "{{ congrats.common.split('\n') }}"
|
2017-05-22 02:28:18 +00:00
|
|
|
- " {% if p12.changed %}{{ congrats.p12_pass }}{% endif %}"
|
2017-04-29 14:48:25 +00:00
|
|
|
tags: always
|
|
|
|
rescue:
|
|
|
|
- debug: var=fail_hint
|
|
|
|
tags: always
|
|
|
|
- fail:
|
|
|
|
tags: always
|