2018-08-27 14:05:45 +00:00
|
|
|
---
|
2019-09-28 00:10:20 +00:00
|
|
|
- name: Set subjectAltName as a fact
|
2018-08-27 14:05:45 +00:00
|
|
|
set_fact:
|
2019-02-25 16:58:09 +00:00
|
|
|
IP_subject_alt_name: "{{ (IP_subject_alt_name if algo_provider == 'local' else cloud_instance_ip) | lower }}"
|
2018-08-27 14:05:45 +00:00
|
|
|
|
|
|
|
- name: Add the server to an inventory group
|
|
|
|
add_host:
|
|
|
|
name: "{% if cloud_instance_ip == 'localhost' %}localhost{% else %}{{ cloud_instance_ip }}{% endif %}"
|
|
|
|
groups: vpn-host
|
|
|
|
ansible_connection: "{% if cloud_instance_ip == 'localhost' %}local{% else %}ssh{% endif %}"
|
2020-01-07 13:28:19 +00:00
|
|
|
ansible_ssh_user: "{{ ansible_ssh_user|default('root') }}"
|
|
|
|
ansible_ssh_port: "{{ ansible_ssh_port|default(22) }}"
|
2022-07-30 12:01:24 +00:00
|
|
|
ansible_python_interpreter: /usr/bin/python3
|
2018-08-27 14:05:45 +00:00
|
|
|
algo_provider: "{{ algo_provider }}"
|
|
|
|
algo_server_name: "{{ algo_server_name }}"
|
|
|
|
algo_ondemand_cellular: "{{ algo_ondemand_cellular }}"
|
|
|
|
algo_ondemand_wifi: "{{ algo_ondemand_wifi }}"
|
|
|
|
algo_ondemand_wifi_exclude: "{{ algo_ondemand_wifi_exclude }}"
|
2019-06-19 15:31:43 +00:00
|
|
|
algo_dns_adblocking: "{{ algo_dns_adblocking }}"
|
2018-08-27 14:05:45 +00:00
|
|
|
algo_ssh_tunneling: "{{ algo_ssh_tunneling }}"
|
2019-07-10 16:31:25 +00:00
|
|
|
algo_store_pki: "{{ algo_store_pki }}"
|
2018-08-27 14:05:45 +00:00
|
|
|
IP_subject_alt_name: "{{ IP_subject_alt_name }}"
|
2020-01-31 10:24:29 +00:00
|
|
|
alternative_ingress_ip: "{{ alternative_ingress_ip | default(omit) }}"
|
2020-01-07 13:28:19 +00:00
|
|
|
cloudinit: "{{ cloudinit|default(false) }}"
|
2018-08-27 14:05:45 +00:00
|
|
|
|
|
|
|
- name: Additional variables for the server
|
|
|
|
add_host:
|
|
|
|
name: "{% if cloud_instance_ip == 'localhost' %}localhost{% else %}{{ cloud_instance_ip }}{% endif %}"
|
2019-11-01 08:57:20 +00:00
|
|
|
ansible_ssh_private_key_file: "{{ SSH_keys.private_tmp }}"
|
2018-08-27 14:05:45 +00:00
|
|
|
when: algo_provider != 'local'
|
|
|
|
|
|
|
|
- name: Wait until SSH becomes ready...
|
|
|
|
wait_for:
|
2020-01-07 13:28:19 +00:00
|
|
|
port: "{{ ansible_ssh_port|default(22) }}"
|
2018-08-27 14:05:45 +00:00
|
|
|
host: "{{ cloud_instance_ip }}"
|
2022-07-30 12:01:24 +00:00
|
|
|
search_regex: OpenSSH
|
2018-08-27 14:05:45 +00:00
|
|
|
delay: 10
|
|
|
|
timeout: 320
|
|
|
|
state: present
|
|
|
|
when: cloud_instance_ip != "localhost"
|
|
|
|
|
2019-07-10 16:31:25 +00:00
|
|
|
- name: Mount tmpfs
|
|
|
|
import_tasks: tmpfs/main.yml
|
|
|
|
when:
|
|
|
|
- pki_in_tmpfs
|
|
|
|
- not algo_store_pki
|
2022-07-30 12:01:24 +00:00
|
|
|
- ansible_system == "Darwin" or ansible_system == "Linux"
|
2019-07-10 16:31:25 +00:00
|
|
|
|
2018-08-27 14:05:45 +00:00
|
|
|
- debug:
|
|
|
|
var: IP_subject_alt_name
|
|
|
|
|
2020-01-07 13:28:19 +00:00
|
|
|
- name: Wait 600 seconds for target connection to become reachable/usable
|
|
|
|
wait_for_connection:
|
|
|
|
delegate_to: "{{ item }}"
|
|
|
|
loop: "{{ groups['vpn-host'] }}"
|