Files
chittick_projects/sophos-xgs-ansible/roles/sophos_vpn_remote_access/tasks/main.yml
Jake Kasper 4f1e8d3add Claude 1
2025-12-09 09:33:48 -06:00

44 lines
1.7 KiB
YAML

---
# ============================================================================
# Sophos Remote Access VPN Role - Main Tasks
# ============================================================================
- name: Display remote access VPN configuration overview
ansible.builtin.debug:
msg:
- "======================================"
- "Configuring Remote Access VPN"
- "======================================"
- "Firewall: {{ inventory_hostname }}"
- "Type: {{ sophos_remote_access_vpn.type | default('Not configured') }}"
tags: ['always']
when: sophos_remote_access_vpn is defined
- name: Skip remote access VPN configuration (not defined)
ansible.builtin.debug:
msg: "No remote access VPN configuration defined for {{ inventory_hostname }}"
when: sophos_remote_access_vpn is not defined
tags: ['always']
- name: Configure remote access VPN
ansible.builtin.uri:
url: "https://{{ sophos_mgmt_host }}:{{ sophos_mgmt_port }}/webconsole/APIController"
method: POST
validate_certs: "{{ sophos_validate_certs }}"
headers:
Content-Type: "application/x-www-form-urlencoded"
body: "reqxml={{ lookup('template', 'remote_access_vpn.json.j2') | urlencode }}"
status_code: [200, 201]
timeout: "{{ sophos_api_timeout }}"
register: remote_vpn_result
no_log: "{{ sophos_no_log_sensitive }}"
when: sophos_remote_access_vpn is defined
changed_when: "'successful' in remote_vpn_result.content | lower"
tags: ['vpn', 'remote-access']
- name: Remote access VPN configuration completed
ansible.builtin.debug:
msg: "Remote access VPN configured successfully"
when: sophos_remote_access_vpn is defined
tags: ['always']