GithubHelp home page GithubHelp logo

pimvh / wireguard Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 64 KB

Ansible role to configure Wireguard

License: GNU General Public License v3.0

Python 43.19% Jinja 56.81%
ansible molecule-tested role vpn wireguard

wireguard's Introduction

Molecule test

Requirements

  1. Ansible installed:
sudo apt install python3
python3 -m ensurepip --upgrade
pip3 install ansible
  1. ansible.utils.ipaddr:
pip3 install netaddr

Required variables

Set the variables as shown in defined.

---
wireguard_server_config_dir: /etc/wireguard
wireguard_client_config_dir: $HOME
wireguard_client_config_storage_host: localhost


wireguard_generate_server_keys: false
wireguard_generate_preshared_key: false
wireguard_provision_client: true
wireguard_show: false

wireguard_configure_sysctl: true

wireguard_iffname: "wg0"
wireguard_endpoint: ""
wireguard_range_v4: ""
wireguard_range_v6: ""
wireguard_port: ""
wireguard_dns: ""
wireguard_routed_ips: ""
wireguard_peers: []
#   - name: harry
#     routed_ips: 0.0.0.0/0, ::/0         # the IPv4/IPv6 addresses you would like to route (if this is not defined wg_routed_ips is used)
#     dns: 1.1.1.1, 2606:4700:4700::1111  # the DNS your peer uses when using the VPN (if this is not defined wg_dns is used)
#     force: false                        # can be skipped, whether to force recreate, overwriting keys

See the argument spec in meta/main.yaml for additional descriptions.

The ansible networking module:

ansible.utils.ipaddr

Example playbook

hosts:
  - foo
roles:
  - ansible-wireguard

Please note that this role does not take care of allowing wireguard through the firewall and other iptables/nftables config, as this goes beyond the scope of this role. You have do that manually, or use other roles.

TLDR - What will happen if I run this

  • install wireguard
  • generate server config/keys (on remote target)
  • generate client config where requested
  • save client configs where requested (can be set to any host)
  • bring the wg interface up (using systemd)
  • show wg config when requested

wireguard's People

Contributors

ontonny avatar pimvh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.