{"id":16761819,"url":"https://github.com/angristan/ansible-wireguard","last_synced_at":"2025-03-23T15:31:10.589Z","repository":{"id":39095898,"uuid":"171141730","full_name":"angristan/ansible-wireguard","owner":"angristan","description":"Ansible role for Wireguard - setup a mesh private network for your servers","archived":false,"fork":false,"pushed_at":"2023-06-13T20:43:56.000Z","size":7,"stargazers_count":27,"open_issues_count":0,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-15T15:45:00.080Z","etag":null,"topics":["ansible","debian","ubuntu","vpn","wireguard"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angristan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-17T16:03:05.000Z","updated_at":"2025-01-24T20:58:40.000Z","dependencies_parsed_at":"2024-10-28T16:37:02.244Z","dependency_job_id":null,"html_url":"https://github.com/angristan/ansible-wireguard","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angristan%2Fansible-wireguard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angristan%2Fansible-wireguard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angristan%2Fansible-wireguard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angristan%2Fansible-wireguard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angristan","download_url":"https://codeload.github.com/angristan/ansible-wireguard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245122738,"owners_count":20564364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","debian","ubuntu","vpn","wireguard"],"created_at":"2024-10-13T04:43:32.271Z","updated_at":"2025-03-23T15:31:10.567Z","avatar_url":"https://github.com/angristan.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible role for Wireguard\n\nThis role will install WireGuard from the Sid repo on Debian 9 and from the PPA on Ubuntu.\n\nThe role's scope is an inventory group, from which it will define peers (see the example below).\n\nThe role does **not** handle keys. You can create a pair with:\n\n```sh\nprivate_key=$(wg genkey)\npublic_key=$(echo $private_key | wg pubkey)\necho \"private key: $private_key\"\necho \"public key: $public_key\"\n```\n\nThen put these in `wireguard_public_key` and `wireguard_private_key` for each host (the use of *ansible-vault* is recommended).\n\nBu default, the endpoint for each peer is its default IPv4 address from the Ansible facts. This can be overwritten with `wireguard_endpoint`.\n\n## Example playbook\n\nIn this example we'll use `host1` and `host2`, which are part of the `web` inventory group.\n\nThe inventory:\n\n```ini\n[web]\nhost1\nhost2\n```\n\nThe vars in `group_vars/web.yml`:\n\n```yaml\nwireguard_listen_port: 1194\nwireguard_interface: wg0\nwireguard_group: web\n```\n\n`host_vars/host1.yml`:\n\n```yaml\nwireguard_address: 10.0.0.1\nwireguard_public_key: 'Z3YGMbf/RBj0dg3bOhV2ijxx05OQ0s3MlI5u60kWlng='\nwireguard_private_key: 'GGp+zuAJwzHm3Q+EimK0tYA3jF7ipnn3GwdIzbBj3V8='\n```\n\n`host_vars/host2.yml`:\n\n```yaml\nwireguard_address: 10.0.0.2\nwireguard_public_key: 'oIQu/u/amX4WsvX/MeSSGtL8hxbUdtX3P4JGICV3bRw='\nwireguard_private_key: 'uCpU57hdstHu3JarIm8XbLxbPbNq4gtGSdnTNi3ksl8='\n```\n\nThe playbook\n\n```yaml\n---\n\n- hosts: web\n  roles:\n    - name: wireguard\n      tags: wireguard\n```\n\nThe role will:\n\n- Install wireguard\n- Enable IPv4 forwarding\n- Setup the configuration file in `/etc/wireguard/{{ wireguard_interface }}.conf` with `[Interface]` and `[Peer]` as needed\n- Update `/etc/hosts` with the inventory_names + their WireGuard IP\n- Enable and start the WireGuard interface\n\nIn our example, the role will append this to `/etc/hosts` automatically:\n\nOn host1:\n\n```\n10.0.0.2 host2\n```\n\nOn host2:\n\n```\n10.0.0.1 host1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangristan%2Fansible-wireguard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangristan%2Fansible-wireguard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangristan%2Fansible-wireguard/lists"}