CloudRouterDemo
This commit is contained in:
commit
62c86b96ff
23 files changed
+1382
No files matched your search
@@ -0,0 +1,32 @@
|
||||
---
|
||||
- name: Install StrongSwan including extra plugins
|
||||
apt:
|
||||
name: [strongswan, strongswan-swanctl, libstrongswan-extra-plugins]
|
||||
state: present
|
||||
|
||||
- name: Configure swanctl.conf
|
||||
template:
|
||||
src: swanctl.conf.j2
|
||||
dest: /etc/swanctl/conf.d/deployment.conf
|
||||
mode: '0644'
|
||||
|
||||
- name: Configure StrongSwan charon.conf to load all tunnels on startup
|
||||
block:
|
||||
- name: Check if swanctl startup command already exists in charon.conf
|
||||
command: grep -q "swanctl = /usr/sbin/swanctl --load-all" /etc/strongswan.d/charon.conf
|
||||
register: swanctl_exists
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: Update charon.conf to include swanctl startup command
|
||||
shell: |
|
||||
sed -i '/start-scripts\s*{/,/}/{
|
||||
/}/i\ swanctl = /usr/sbin/swanctl --load-all
|
||||
}' /etc/strongswan.d/charon.conf
|
||||
when: swanctl_exists.rc != 0
|
||||
|
||||
- name: Restart StrongSwan (using strongswan-starter)
|
||||
systemd:
|
||||
name: strongswan-starter
|
||||
state: restarted
|
||||
enabled: yes
|
||||
@@ -0,0 +1,58 @@
|
||||
connections {
|
||||
gre-main {
|
||||
local_addrs = {{ wan_ip }}
|
||||
remote_addrs = {{ remote_main_isp_ip }}
|
||||
|
||||
local { auth = psk }
|
||||
remote { auth = psk }
|
||||
|
||||
version = 2
|
||||
proposals = {{ ike_proposal }}
|
||||
rekey_time = {{ ike_lifetime }}s
|
||||
|
||||
children {
|
||||
gre-main {
|
||||
local_ts = dynamic[gre]
|
||||
remote_ts = dynamic[gre]
|
||||
esp_proposals = {{ esp_proposal }}
|
||||
rekey_time = {{ esp_lifetime }}s
|
||||
mode = transport
|
||||
dpd_action = restart
|
||||
close_action = restart
|
||||
}
|
||||
}
|
||||
dpd_timeout = {{ dpd_timeout }}s
|
||||
}
|
||||
|
||||
gre-backup {
|
||||
local_addrs = {{ wan_ip }}
|
||||
remote_addrs = {{ remote_backup_isp_ip }}
|
||||
|
||||
local { auth = psk }
|
||||
remote { auth = psk }
|
||||
|
||||
version = 2
|
||||
proposals = {{ ike_proposal }}
|
||||
rekey_time = {{ ike_lifetime }}s
|
||||
|
||||
children {
|
||||
gre-backup {
|
||||
mode = transport
|
||||
local_ts = dynamic[gre]
|
||||
remote_ts = dynamic[gre]
|
||||
esp_proposals = {{ esp_proposal }}
|
||||
rekey_time = {{ esp_lifetime }}s
|
||||
mode = transport
|
||||
dpd_action = restart
|
||||
close_action = restart
|
||||
}
|
||||
}
|
||||
dpd_timeout = {{ dpd_timeout }}s
|
||||
}
|
||||
}
|
||||
|
||||
secrets {
|
||||
ike {
|
||||
secret = "{{ ipsec_psk }}"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user