algo/roles/client/tasks/main.yml

61 lines
1.8 KiB
YAML
Raw Normal View History

2017-03-03 17:46:11 +00:00
- name: Gather Facts
setup:
- name: Include system based facts and tasks
include_tasks: systems/main.yml
2017-03-03 17:46:11 +00:00
- name: Install prerequisites
package: name="{{ item }}" state=present
with_items:
- "{{ prerequisites }}"
- name: Install strongSwan
2017-03-03 17:46:11 +00:00
package: name=strongswan state=present
- name: Setup the ipsec config
template:
src: "roles/vpn/templates/client_ipsec.conf.j2"
dest: "{{ configs_prefix }}/ipsec.{{ IP_subject_alt_name }}.conf"
mode: '0644'
with_items:
2017-03-04 20:05:02 +00:00
- "{{ vpn_user }}"
2017-03-03 17:46:11 +00:00
notify:
- restart strongswan
- name: Setup the ipsec secrets
template:
src: "roles/vpn/templates/client_ipsec.secrets.j2"
dest: "{{ configs_prefix }}/ipsec.{{ IP_subject_alt_name }}.secrets"
mode: '0600'
with_items:
2017-03-04 20:05:02 +00:00
- "{{ vpn_user }}"
2017-03-03 17:46:11 +00:00
notify:
- restart strongswan
- name: Include additional ipsec config
lineinfile:
dest: "{{ item.dest }}"
line: "{{ item.line }}"
create: yes
with_items:
- dest: "{{ configs_prefix }}/ipsec.conf"
2017-06-21 17:39:54 +00:00
line: "include ipsec.{{ IP_subject_alt_name }}.conf"
2017-03-03 17:46:11 +00:00
- dest: "{{ configs_prefix }}/ipsec.secrets"
2017-06-21 17:39:54 +00:00
line: "include ipsec.{{ IP_subject_alt_name }}.secrets"
2017-03-03 17:46:11 +00:00
notify:
- restart strongswan
- name: Setup the certificates and keys
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
2017-03-04 20:05:02 +00:00
- src: "configs/{{ IP_subject_alt_name }}/pki/certs/{{ vpn_user }}.crt"
2017-06-21 17:39:54 +00:00
dest: "{{ configs_prefix }}/ipsec.d/certs/{{ vpn_user }}.crt"
2017-03-03 17:46:11 +00:00
- src: "configs/{{ IP_subject_alt_name }}/pki/cacert.pem"
dest: "{{ configs_prefix }}/ipsec.d/cacerts/{{ IP_subject_alt_name }}.pem"
2017-03-04 20:05:02 +00:00
- src: "configs/{{ IP_subject_alt_name }}/pki/private/{{ vpn_user }}.key"
2017-06-21 17:39:54 +00:00
dest: "{{ configs_prefix }}/ipsec.d/private/{{ vpn_user }}.key"
2017-03-03 17:46:11 +00:00
notify:
- restart strongswan