All Projects → evrardjp → ansible-tinc

evrardjp / ansible-tinc

Licence: Apache-2.0 license
Role to install tinc in a star/ring topology (w/ leaf/spine) (based on your variables)

Programming Languages

Jinja
831 projects
shell
77523 projects

Projects that are alternatives of or similar to ansible-tinc

Openvpn Install
OpenVPN road warrior installer for Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora
Stars: ✭ 14,199 (+94560%)
Mutual labels:  debian, centos, vpn
Openvpn Install
Set up your own OpenVPN server on Debian, Ubuntu, Fedora, CentOS or Arch Linux.
Stars: ✭ 7,142 (+47513.33%)
Mutual labels:  debian, centos, vpn
ansible-kafka
Ansible role for installing and configuring Apache Kafka on RedHat and Debian platforms.
Stars: ✭ 56 (+273.33%)
Mutual labels:  debian, centos, molecule
Wg Install
Wireguard road warrior installer for Ubuntu, Debian, CentOS and Fedora
Stars: ✭ 99 (+560%)
Mutual labels:  debian, centos, vpn
Wireguard Install
WireGuard road warrior installer for Ubuntu, Debian, CentOS and Fedora
Stars: ✭ 650 (+4233.33%)
Mutual labels:  debian, centos, vpn
Postinstall
💻 Bash Script to automate post-installation steps
Stars: ✭ 104 (+593.33%)
Mutual labels:  debian, openwrt, centos
Patchman
Patchman is a Linux Patch Status Monitoring System
Stars: ✭ 163 (+986.67%)
Mutual labels:  debian, centos
Ansible Role Hardening
Ansible role to apply a security baseline. Systemd edition.
Stars: ✭ 188 (+1153.33%)
Mutual labels:  debian, centos
Mtprotoproxyinstaller
One-click script to install MTProto Proxy server on CentOS, Ubuntu and Debian
Stars: ✭ 216 (+1340%)
Mutual labels:  debian, centos
v-switch
Virtual Encrypted Switch across the network, using UDP + AES + TAP
Stars: ✭ 27 (+80%)
Mutual labels:  vpn, tinc
Oracle Java
Ansible role to install Oracle Java 8/11 on Debian and RedHat based distributions.
Stars: ✭ 144 (+860%)
Mutual labels:  debian, centos
Kvm Install Vm
Bash script to build local virtual machines using KVM/libvirt and cloud-init.
Stars: ✭ 248 (+1553.33%)
Mutual labels:  debian, centos
vagrant-templates
Vagrantfiles for self-contained development/test environments.
Stars: ✭ 28 (+86.67%)
Mutual labels:  debian, centos
Trojan Tutor.github.io
trojan 教程 自建梯子教程 trojan教程 trojan-gfw 科学上网 代理工具 翻墙 Ubuntu Debian 小白教程 https伪装
Stars: ✭ 150 (+900%)
Mutual labels:  debian, centos
Lamp
Install LAMP(Linux + Apache + MySQL/MariaDB + PHP ) for CentOS/Debian/Ubuntu
Stars: ✭ 2,456 (+16273.33%)
Mutual labels:  debian, centos
Dockerfiles
Phalcon Dockerfiles used for internal purposes.
Stars: ✭ 145 (+866.67%)
Mutual labels:  debian, centos
wsl-distrod
Distrod is a meta-distro for WSL 2 which installs Ubuntu, Arch, Debian, Gentoo, etc. with systemd in a minute for you. Distrod also has built-in auto-start feature on Windows startup and port forwarding ability.
Stars: ✭ 1,637 (+10813.33%)
Mutual labels:  debian, centos
ipv6-dhclient-script
IPv6 w/ dhclient configuration script (Debian/RedHat-based distros)
Stars: ✭ 68 (+353.33%)
Mutual labels:  debian, centos
Invidious-Updater
Automatic install and update script for Invidious
Stars: ✭ 181 (+1106.67%)
Mutual labels:  debian, centos
ansible-haproxy
Installs and configures HAProxy
Stars: ✭ 19 (+26.67%)
Mutual labels:  debian, centos

Tinc

Daily branch test status

This role installs tinc in a star or a ring topology.

The nodes listed in the group [tinc_nodes] is a full list of nodes to apply/install the role.

The nodes part of [tinc_spine_nodes] are the "core" nodes, where all the nodes connect.

The nodes in [tinc_leaf_nodes] connect only to the spine nodes. Devices behind a NAT would be an example of such.

If all the [tinc_nodes] are part of the [tinc_spine_nodes], you have a more "ringy" topology. If you have one node in [tinc_spine_nodes], you have a more "starry" topology.

Requirements

  • Ubuntu 18.04 / CentOS 7 (or above) / OpenWRT
  • On CentOS and above, EPEL repo needs to be configured in advance.

To do so, you can run the following:

yum install epel-release || dnf install epel-release
yum update || dnf update

Role Variables

  • tinc_key_size: The size of the generated keys (Default: 4096)
  • tinc_address_family can be ipv4/ipv6/any (or undefined)
  • tinc_mode can be router, switch, or hub. (See https://www.tinc-vpn.org/documentation/tinc.conf.5). (Default: router)
  • tinc_netname: The tinc network name
  • tinc_vpn_ip: The ip to assign to a single VPN endpoint. Use host vars to set it.
  • tinc_vpn_cidr: The cidr used in tinc network (Default: /24, or force /32 in router mode).
  • tinc_vpn_interface: The device for tinc to use, in case there are multiple tun devices (Default: tun0)
  • tinc_control_plane_bind_ip: The ip for tincd service to bind to (Default: ansible_default_ipv4.address }} )

Inventory must set tinc_control_plane_bind_ip (for core) and/or tinc_vpn_ip (for core and edge nodes). Please have a look in the task files.

Examples

Router mode, ring topology

(Short) Inventory:

[tinc_nodes:children]
tinc_spine_nodes
tinc_leaf_nodes

[tinc_spine_nodes]
node1 tinc_vpn_ip=10.10.0.11
node2 tinc_vpn_ip=10.10.0.12
node3 tinc_vpn_ip=10.10.0.13

[tinc_leaf_nodes]
node1
node2
node3

Router mode, star topology

(Detailed) Inventory:

[tinc_nodes]
node1
node2
node3

[tinc_spine_nodes]
node1

[tinc_leaf_nodes]
node1
node2
node3

Group vars for tinc_nodes:

tinc_netname: mynetname
tinc_vpn_interface: tun0

Host vars for spine node, node1:

tinc_control_plane_bind_ip: "{{ ansible_eth0.ipv4.address | default(ansible_default_ipv4.address) }}"
tinc_vpn_ip: 10.10.0.10

Host vars for edge node, node2:

tinc_vpn_ip: 10.10.0.11

Host vars for edge node, node3:

tinc_vpn_ip: 10.10.0.12

Dependencies

None

Example Playbook

See https://raw.githubusercontent.com/evrardjp/ansible-tinc/master/molecule/default/converge.yml

Don't forget to set the necessary variables in your inventory (see above).

Testing

Tests are based on Ansible Molecule framework which:

  • checks role syntax
  • starts several containers with different OS (only for tests. We don't mix Tinc versions in production)
  • applies this role to each container
  • runs idempotency tests (make sure that second run will not make unexpected changes)
  • verifies that each prepared node able to ping other nodes over VPN

Tests run in a github actions on PR and daily. Additionally you may execute them on local machine.

Dependencies you need to have installed for running the tests:

Run tests manually, using molecule directly

You can existing tests for star and ring topologies:

cd ansible-tinc
molecule test # this run default tests for Ring scenario
molecule test -s star

The 'molecule test' command execute full scenario: 'create', 'converge', 'check idempotency', 'verify' and 'destroy' steps. Often you don't want to have container immediately destroyed and need access it for debug. For this might be useful replace 'molecule test' with:

molecule converge # this create containers and apply the role
molecule verify # run tests described in molecule/default/verify.yml

# after both steps you have live Docker containers
# you can access them with usual commands 'docker ps', 'docker exec' etc

molecule destroy

Run tests manually, using tox

tox is a test runner for python. It will install all the necessary python dependencies (ansible, molecule[docker]) in a virtual environment.

To run a test:

tox -e ansible-<version>-<tinc scenario>

See supported values for version in tox.ini. Current testable scenarios for tinc are ring, or star. Positional arguments will be passed to the molecule test command.

For example, to run a test for ansible-2.9, with the ring topology and prevent molecule to destroy the environment:

tox -e ansible-2.9-ring -- --destroy=never

How to test role with new OS

add new image to molecule/default/molecule.yml and molecule/star/molecule.yml following existing examples. Files are similar except the variables scenario.name and groups. Next hightlights could be hepful:

  • code privileged: true with command: /sbin/init enable systemd if container support it. Please don't forget that privileged containers in your system could be a risk.
  • Docker images lack some standard software, so molecule/default/converge.yml take care about installing necessary dependencies
  • according with ansible-community/molecule#959 Docker doesn't allow modify /etc/hosts in a container. To workaround this we skipping one step with molecule-notest tag in tasks/tinc_configure.yml and modifying /etc/hosts during container creation - following the corresponding directives in molecule/default/molecule.yml

License

Apache2

Author Information

Jean-Philippe Evrard

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].