Skip to content

Commit a956e9e

Browse files
committed
feat(staticclients): support dual IPv6 / stack stack clients
1 parent 7c42846 commit a956e9e

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ This role requires an apt based system.
5252

5353
A client object is a dictionary that can contain the following keys.
5454

55-
| Key | Mandatory? | Description |
56-
| ------------ | ------------------------ | ---------------------------------------------------------------------- |
57-
| `name` | :heavy_check_mark: | Name of the client. Has to be unique. |
58-
| `ip_address` | :heavy_multiplication_x: | IP address given to the client via `ifconfig-push` |
59-
| `netmask` | :heavy_multiplication_x: | Netmask of that IP address |
60-
| `push` | :heavy_multiplication_x: | Miscellaneous strings to be used with the `push` command to the client |
55+
| Key | Mandatory? | Description |
56+
| ------ | ------------------------ | ---------------------------------------------------------------------- |
57+
| `name` | :heavy_check_mark: | Name of the client. Has to be unique. |
58+
| `ipv4` | :heavy_multiplication_x: | IPv4 address given to the client via `ifconfig-push` |
59+
| `ipv6` | :heavy_multiplication_x: | IPv6 address given to the client via `ifconfig-ipv6-push` |
60+
| `push` | :heavy_multiplication_x: | Miscellaneous strings to be used with the `push` command to the client |
6161

6262
### LDAP
6363

tasks/client_config_dir.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
src: staticclient.j2
44
dest: "{{ openvpn_base_dir }}/staticclients/OpenVPN-Client-{{ openvpn_server_hostname[:24] }}-{{ item.name[:24] }}"
55
mode: 644
6-
when: item.ip_address is defined

templates/staticclient.j2

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
ifconfig-push {{ item.ip_address }} {{ item.netmask }}
1+
{% if item.ipv4 is defined %}
2+
ifconfig-push {{ item.ipv4 }} {{ openvpn_tunnel_subnetv4 | ansible.utils.ipaddr('netmask') }}
3+
{% endif %}
4+
{% if item.ipv6 is defined %}
5+
ifconfig-ipv6-push {{ item.ipv6 }}/{{ openvpn_tunnel_subnetv6 | ansible.utils.ipaddr('prefix') }} {{ openvpn_tunnel_subnetv6 | ansible.utils.nthhost(2) }}
6+
{% endif %}
27
{% for push_option in item.push | default(openvpn_default_client_push) %}
38
push "{{ push_option }}"
49
{% endfor %}

0 commit comments

Comments
 (0)