{"id":20714047,"url":"https://github.com/tazeg/ansible-wireguard","last_synced_at":"2025-07-12T20:03:02.673Z","repository":{"id":54267684,"uuid":"253915183","full_name":"Tazeg/ansible-wireguard","owner":"Tazeg","description":"Create a VPN server with WireGuard","archived":false,"fork":false,"pushed_at":"2021-02-28T09:16:17.000Z","size":7,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T23:05:06.727Z","etag":null,"topics":["ansible","ansible-playbook","wireguard"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tazeg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["Tazeg"],"custom":["https://keybase.io/jeffprod"]}},"created_at":"2020-04-07T21:23:09.000Z","updated_at":"2022-05-25T23:52:33.000Z","dependencies_parsed_at":"2022-08-13T10:30:59.190Z","dependency_job_id":null,"html_url":"https://github.com/Tazeg/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/Tazeg%2Fansible-wireguard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tazeg%2Fansible-wireguard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tazeg%2Fansible-wireguard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tazeg%2Fansible-wireguard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tazeg","download_url":"https://codeload.github.com/Tazeg/ansible-wireguard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250395287,"owners_count":21423400,"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","ansible-playbook","wireguard"],"created_at":"2024-11-17T02:28:55.653Z","updated_at":"2025-04-23T08:11:33.147Z","avatar_url":"https://github.com/Tazeg.png","language":null,"funding_links":["https://github.com/sponsors/Tazeg","https://keybase.io/jeffprod"],"categories":[],"sub_categories":[],"readme":"# Ansible WireGuard\n\nThis creates a VPN server on Ubuntu 18.04 with WireGuard.\nScript is based on [Getting Started with WireGuard](https://miguelmota.com/blog/getting-started-with-wireguard/).\n\n## Requirement\n\nOn your client computer :\n\n- Install [WireGuard](https://www.wireguard.com/install/)\n- Generate you client private and public keys :\n  ```bash\n  umask 077\n  wg genkey | tee privatekey | wg pubkey \u003e publickey\n  ```\n- Install [Ansible](https://www.ansible.com/)\n- As root :\n  ```bash\n  ip link add dev wg0 type wireguard\n  ip address add dev wg0 192.168.2.1/24\n  ```\n\n## Usage\n\nThe following script does the job to make for example a VPS as a VPN server. Your WireGuard client public key will be asked.\n\n```bash\ngit clone https://github.com/Tazeg/ansible-wireguard.git\ncd ansible-wireguard\nansible-playbook -i \u003cIP\u003e, playbooks/wireguard_server.yml -e \"ansible_port=2222\" -e \"ansible_user=root\"\n```\n\n- `\u003cIP\u003e`: replace with your Ubuntu server public IP\n- `-e \"ansible_port=2222\"`: optional, if you are not using ssh on port 22\n- `-e \"ansible_user=root\"`: ssh connexion as root\n\nAfter running the ansible script, create the file `/etc/wireguard/wg0.conf` on your client computer and replace `\u003cvariables\u003e` :\n\n```ini\n# local device\n[Interface]\nAddress = 10.0.0.2/32\nPrivateKey = \u003cyour client private key\u003e\nDNS = 1.1.1.1\n\n# server\n[Peer]\nPublicKey = \u003cthe server public key given by ansible script\u003e\nEndpoint = \u003cIP\u003e:51820\nAllowedIPs = 0.0.0.0/0\nPersistentKeepalive = 25\n```\n\nThen run on your computer :\n\n```bash\ncurl https://ipinfo.io/ip # your computer public IP\nsudo wg-quick up wg0\ncurl https://ipinfo.io/ip # you now have the public IP of the server\n```\n\nTo stop connexion :\n\n```bash\nsudo wg-quick down wg0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftazeg%2Fansible-wireguard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftazeg%2Fansible-wireguard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftazeg%2Fansible-wireguard/lists"}