Hyunsun Moon | 6c6db95 | 2020-03-04 20:50:51 -0800 | [diff] [blame] | 1 | # Copyright 2020-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | --- |
| 16 | - name: Run "apt update" |
| 17 | apt: |
| 18 | update_cache: yes |
| 19 | tags: vpn |
| 20 | |
| 21 | - name: Install strongSwan |
| 22 | apt: |
| 23 | name: strongswan |
| 24 | state: present |
| 25 | tags: vpn |
| 26 | |
| 27 | - name: Start strongSwan |
| 28 | service: |
| 29 | name: strongswan |
| 30 | state: started |
| 31 | enabled: yes |
| 32 | tags: vpn |
| 33 | |
| 34 | - name: Create ipsec config and secrets file |
| 35 | template: |
| 36 | src: "{{ item.src }}" |
| 37 | dest: "{{ item.dest }}" |
| 38 | owner: root |
| 39 | group: root |
| 40 | mode: 0640 |
| 41 | loop: |
| 42 | - { src: 'etc/ipsec.secrets.j2', dest: '/etc/ipsec.secrets' } |
| 43 | - { src: 'etc/ipsec.conf.j2', dest: '/etc/ipsec.conf' } |
| 44 | notify: ipsec restart |
| 45 | tags: vpn |