Skip to content

Commit 45728b9

Browse files
authored
Merge pull request #95 from play-iot/release/vpnc-deployer/0.10.0
Release/vpnc deployer/0.10.0
2 parents b84bb18 + 756ee90 commit 45728b9

File tree

9 files changed

+50
-4
lines changed

9 files changed

+50
-4
lines changed

.github/workflows/build-release-vpnc-deployer.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ jobs:
181181
docker create --name ${{ env.CLI_APP_IMAGE }} localhost:5000/${{ env.CLI_APP_IMAGE }}:build
182182
docker cp ${{ env.CLI_APP_IMAGE }}:/app/${{ env.CLI_APP_CODE }} /tmp/${{ env.CLI_APP_CODE }}
183183
docker rm -f ${{ env.CLI_APP_IMAGE }}
184+
chmod +x /tmp/${{ env.CLI_APP_CODE }}
184185
185186
- name: Upload CLI tool
186187
uses: actions/upload-artifact@v2

cli/CHANGELOG-VPNC-DEPLOYER.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
11
# Changelog
22

3-
## [v0.9.4](https://github.com/play-iot/iot-vpn/tree/vpnc-deployer/v0.9.4) (2021-05-13)
3+
## [v0.10.0](https://github.com/play-iot/iot-vpn/tree/vpnc-deployer/v0.10.0) (2021-06-16)
44

55
### Improvement
6+
7+
- Provide workaround for [#91](https://github.com/play-iot/iot-vpn/issues/91)
8+
9+
## [v0.9.4](https://github.com/play-iot/iot-vpn/tree/vpnc-deployer/v0.9.4) (2021-06-10)
10+
11+
### Improvement
12+
613
- Add `arm64` option in `deployer-cli` to allow downloading `vpnc-armv64`
714
- Sync version with `vpnc`
815

916
## [v0.9.3](https://github.com/play-iot/iot-vpn/tree/vpnc-deployer/v0.9.3) (2021-05-13)
1017

1118
### Improvement
19+
1220
- Add `vpnc-deployer-cli` tool
1321
- Sync version with `vpnc`
1422

1523
## [v0.1.2](https://github.com/play-iot/iot-vpn/tree/vpnc-deployer/v0.1.2) (2021-05-06)
1624

1725
### Improvement
26+
1827
- Use [mitogen](https://github.com/mitogen-hq/mitogen) with `Ansible` to improve performance
1928
- Add missing `jmespath` lib in `Ansible` image
2029

2130
## [v0.1.1](https://github.com/play-iot/iot-vpn/tree/vpnc-deployer/v0.1.1) (2021-05-05)
2231

2332
### Fixed
33+
2434
- Fix wrong variable
2535

2636
## [v0.1.0](https://github.com/play-iot/iot-vpn/tree/vpnc-deployer/v0.1.0) (2021-05-05)
2737

2838
### Added
39+
2940
- `Ansible` for bulk setup/rollout/extend VPNC

cli/ansible/roles/vpnc-state/tasks/01_check_vpnc_cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{ resp_vpnc_state | combine({ 'is_exec': runtime_is_exec.rc == 0,
1212
'error': None if runtime_is_exec.rc == 0 else runtime_is_exec.msg }) }}
1313
14-
- name: Check VPNC CLI version
14+
- name: Query VPNC CLI version
1515
when: not ansible_check_mode and runtime_is_exec.rc == 0
1616
command: "{{ vpnc_cli }} version --json"
1717
register: runtime_is_ver

cli/ansible/roles/vpnc-state/tasks/02_check_vpnc_service.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- name: Check VPNC service status
1+
- name: Query VPNC service status
22
when: not ansible_check_mode and runtime_is_exec.rc == 0 and runtime_is_ver.rc == 0
33
command: "{{ vpnc_cli }} status {{ args_vpn_state_test_domains | map('regex_replace', '^(.*)$', '--domain \\1') | join(' ') }} --json"
44
register: runtime_is_status
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
- name: Check is Connman
2+
command: "which connmanctl"
3+
register: runtime_is_connmand
4+
ignore_errors: yes
5+
6+
- name: Setup Connman DHCP Client
7+
when: runtime_is_connmand.rc == 0
8+
block:
9+
- name: Restart VPN service
10+
ansible.builtin.service:
11+
name: "{{ vpnc_service }}"
12+
state: started
13+
14+
- name: Query VPN status
15+
command: "{{ vpnc_cli }} status --json"
16+
register: runtime_dhcp_is_status
17+
ignore_errors: yes
18+
19+
- name: Run dhclient if needed
20+
when:
21+
- runtime_dhcp_is_status.rc != 0
22+
- (runtime_dhcp_is_status.stdout | from_json)['vpn_account']
23+
- (runtime_dhcp_is_status.stdout | from_json)['vpn_pid'] > 0
24+
- not (runtime_dhcp_is_status.stdout | from_json)['vpn_ip']
25+
command: "dhclient --no-pid -v -nw vpn_{{ (runtime_dhcp_is_status.stdout | from_json)['vpn_account'] }}"
26+
become: yes
27+
become_method: sudo

cli/ansible/vars/global_vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ global_arch_mapping:
44

55
vpn_corp: playio
66
vpnc_cli: "{{ vpn_corp }}-vpnc"
7+
vpnc_service: "{{ vpn_corp }}-vpn"
78
vpnc_artifact: playio-vpnc
89
args_app_dir: /app
910
args_vpnc_dir: "{{ args_app_dir }}/vpnclient"

cli/ansible/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
APP_VERSION = '0.9.5'
1+
APP_VERSION = '0.10.0'
22
HASH_VERSION = 'dev'
33

44
print(f'vpnc-deployer {APP_VERSION}-{HASH_VERSION}')

cli/ansible/wf-vpnc-extend.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
vars:
2828
runtime_vpn_conn: "{{ resp_prepare_credential }}"
2929

30+
- name: Fix Connman DHClient if needed
31+
include_tasks: tasks/connman_dhclient.yml
32+
3033
- name: Validate VPNC state
3134
include_role:
3235
name: vpnc-state

cli/ansible/wf-vpnc-rollout.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
include_role:
3535
name: vpnc-upgrade
3636

37+
- name: Fix Connman DHClient if needed
38+
include_tasks: tasks/connman_dhclient.yml
39+
3740
- name: Validate VPNC state
3841
when: wf_precondition_is_installed or wf_precondition_is_upgraded
3942
include_role:

0 commit comments

Comments
 (0)