-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from roles-ansible/u
Finishing v1 of l3d.wireguard
- Loading branch information
Showing
14 changed files
with
180 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ jobs: | |
uses: ansible-actions/[email protected] | ||
with: | ||
target: "./" | ||
required_collections: 'ansible.posix' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,62 @@ | ||
# ansible_collections_wireguard | ||
Ansible Collection to configure wireguard | ||
[![collection l3d.wireguard](https://ansible.l3d.space/svg/l3d.wireguard_ansible-collection_collection.svg)](https://galaxy.ansible.com/ui/repo/published/l3d/wireguard/) | ||
[![Maintainance](https://ansible.l3d.space/svg/l3d.wireguard_maintainance_collection.svg)](https://ansible.l3d.space/#l3d.wireguard) | ||
[![License](https://ansible.l3d.space/svg/l3d.wireguard_license_collection.svg)](LICENSE) | ||
|
||
Work in Progress | ||
Ansible Collection - l3d.wireguard | ||
============================ | ||
|
||
This is the Ansible Collection ``l3d.wireguard``. A collection to to install wireguard-ui on linux servers. | ||
|
||
## Ansible Roles in l3d.wireguard | ||
- [![l3d.wireguard.wireguardui](https://ansible.l3d.space/svg/l3d.wireguard.wireguardui_ansible-role.svg)](https://galaxy.ansible.com/ui/repo/published/l3d/wireguard/content/role/wireguardui/) - Ansible role to install wireguard-ui | ||
|
||
## Using this Collection | ||
You can install the collection using ansible-galaxy by running: | ||
```bash | ||
ansible-galaxy collection install l3d.wireguard:1.0.0 | ||
``` | ||
|
||
Remember you can to Upgrade to the latest version of the l3d.wireguard collection using the ``--upgrade`` parameter: | ||
```bash | ||
ansible-galaxy collection install l3d.wireguard --upgrade | ||
``` | ||
|
||
|
||
Or you could clone this collection in your local ansible project for example to ``collections/ansible_collections/l3d.wireguard/``. Make sure you checkout [git submodules](https://git-scm.com/docs/git-submodule) too. Example: | ||
``` | ||
# Clone git Repo with submodules to specified path | ||
git clone --recursive https://github.com/roles-ansible/ansible_collection_wireguard.git collections/ansible_collections/l3d/wireguard/ | ||
# change directory | ||
cd collections/ansible_collections/l3d.wireguard/ | ||
# optionally init git submodules | ||
git submodule update --init --recursive | ||
# optionally install all requirements | ||
ansible-galaxy collection install -r requirements.yml --upgrade | ||
``` | ||
|
||
You can also list a collection in ``requirements.yml``: | ||
```yaml | ||
--- | ||
collections: | ||
- name: l3d.wireguard | ||
version: ">=1.0.0" | ||
``` | ||
## Example Playbook | ||
Example Playbook using the l3d.wireguard.wireguardui role: | ||
```yaml | ||
--- | ||
- name: "Install and Setup Wireguard-UI" | ||
hosts: wireguard.example.com | ||
roles: | ||
- {role: l3d.wireguard.wireguardui, tags: wireguardui} | ||
vars: | ||
wireguardui__conf_int_address: '10.42.42.0/24,fd42:1337:4223::/48' | ||
``` | ||
## Requirements | ||
The roles in this collection using the ``community.general`` and ``ansible.posix`` ansible Collections. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.wireguard.wireguardui_ansible-role.svg)](https://galaxy.ansible.com/ui/repo/published/l3d/wireguard/content/role/wireguardui/) | ||
[![MIT License](https://ansible.l3d.space/svg/l3d.wireguard_license_collection.svg)](LICENSE) | ||
[![Maintainance](https://ansible.l3d.space/svg/l3d.wireguard_maintainance_collection.svg)](https://ansible.l3d.space/#l3d.wireguard) | ||
|
||
ansible role wireguard-ui | ||
======================= | ||
|
||
Ansible role to install wireguard-ui | ||
|
||
Visit [github.com/ngoduykhanh/wireguard-ui](https://github.com/ngoduykhanh/wireguard-ui) for more information about wireguard-ui. | ||
|
||
|
||
Variables | ||
----------- | ||
|
||
| Variable | Value | Description | | ||
| --------------------------------- | --------------------------------- | ------------------------------------------------------------ | | ||
| ``wireguardui__version`` | ``latest`` | Wireguard version to install - ``latest`` for newest release | | ||
| ``wireguardui__conf_bind`` | ``127.0.0.1:5000`` | Webserver Bind Port | | ||
| ``wireguardui__conf_int_address`` | ``10.23.42.0/24`` | Wireguard interface ip addesses *(komma seperated)* | | ||
| ``wireguardui__conf_int_port`` | ``51820`` | Wireguard Port | | ||
| ``wireguardui__conf_allowed_ips`` | ``wireguardui__conf_int_address`` | Allowed wireguard IP addresses | | ||
| ``wireguardui__conf_endpoint_ip`` | ``ansible_default_ipv4.address`` | Wireguard endpoint ip | | ||
| ``wireguardui__wg_interface`` | ``wg0`` | Interface for ip forwarding rule | | ||
| ``wireguardui__ipv4_forward`` | ``true`` | set ``net.ipv4.conf.wg0.forwarding`` | | ||
| ``wireguardui__ipv6_forward`` | ``true`` | set ``net.ipv6.conf.wg0.forwarding`` | | ||
| ``submodules_versioncheck`` | ``false`` | optional simple version check | | ||
|
||
## Example Playbook | ||
Example Playbook using the l3d.wireguard.wireguardui role: | ||
|
||
```yaml | ||
--- | ||
- name: "Install and Setup Wireguard-UI" | ||
hosts: wireguard.example.com | ||
roles: | ||
- {role: l3d.wireguard.wireguardui, tags: wireguardui} | ||
vars: | ||
wireguardui__conf_int_address: '10.42.42.0/24,fd42:1337:4223::/48' | ||
``` | ||
Contribution | ||
-------------- | ||
Please feel free to open an issue or Pull-Request | ||
Requirements | ||
-------------- | ||
Ansible Collections ``community.general`` and ``ansible.posix`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
--- | ||
wireguardui__version: 'latest' | ||
|
||
# config | ||
wireguardui__conf_bind: '127.0.0.1:5000' | ||
wireguardui__conf_int_address: '10.23.42.0/24' | ||
wireguardui__conf_int_port: '51820' | ||
wireguardui__conf_allowed_ips: "{{ wireguardui__conf_int_address }}" | ||
wireguardui__conf_endpoint_ip: "{{ ansible_default_ipv4.address }}" | ||
|
||
# network | ||
wireguardui__wg_interface: 'wg0' | ||
wireguardui__ipv4_forward: true | ||
wireguardui__ipv6_forward: true | ||
|
||
# Optional perform simple Versionscheck | ||
submodules_versioncheck: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
- name: Set IPv4 Forwarding | ||
become: true | ||
ansible.posix.sysctl: | ||
name: "net.ipv4.conf.{{ wireguardui__wg_interface }}.forwarding" | ||
value: '1' | ||
sysctl_set: true | ||
state: present | ||
reload: true | ||
when: wireguardui__ipv4_forward | bool | ||
notify: "systemctl restart wireguard-ui.service" | ||
|
||
- name: Set IPv6 Forwarding | ||
become: true | ||
ansible.posix.sysctl: | ||
name: "net.ipv6.conf.{{ wireguardui__wg_interface }}.forwarding" | ||
value: '1' | ||
sysctl_set: true | ||
state: present | ||
reload: true | ||
when: wireguardui__ipv6_forward | bool | ||
notify: "systemctl restart wireguard-ui.service" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ | |
create_home: true | ||
system: true | ||
shell: '/bin/bash' | ||
notify: "systemctl restart wireguard-ui.service" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{{ ansible_managed | comment }} | ||
BIND_ADDRESS="{{ wireguardui__conf_bind }}" | ||
WGUI_SERVER_INTERFACE_ADDRESSES="{{ wireguardui__conf_int_address }}" | ||
WGUI_SERVER_LISTEN_PORT="{{ wireguardui__conf_int_port }}" | ||
WGUI_DEFAULT_CLIENT_ALLOWED_IPS="{{ wireguardui__conf_allowed_ips }}" | ||
WGUI_ENDPOINT_ADDRESS="{{ wireguardui__conf_endpoint_ip }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters