Giter VIP home page Giter VIP logo

ansible-linode-nats's Introduction

Ansible Linode NATS

Usage

Preparations

git clone https://github.com/kmpm/ansible-linode-nats
cd ansible-linode-nats

# get the submodules
git submodule init

# get/update some dependencies
## this is for a version of the linode inventory plugin that supports IPs
ansible-galaxy collection install community.general

# linode api
pip3 install linode_api4

# wireguard-tools, needed to generate keys
sudo apt install wireguard-tools

# set the token
export LINODE_ACCESS_TOKEN='<your token>'

# create a password for ansible vault
echo "Som3Sup3rImaginativ3Secr3tPassword" > vault-pass

#encrypt token and store in group_vars
ansible-vault encrypt_string $LINODE_ACCESS_TOKEN --name linode_token >> group_vars/demo.yml

#encrypt root password and store in group vars
ansible-vault encrypt_string 'Som3Sup3rImaginativ3Secr3tRootPassword' --name root_pass >> group_vars/demo.yml

./generate-host-keys.sh demo-linode-1
./generate-host-keys.sh demo-linode-2
./generate-host-keys.sh demo-linode-3

This will probably cost you money on linode

Warning! The following commands will possibly cost you money on linode and perhaps even destroy any existing infrastructure you have there. It works for me but you should read everything and understand what you are doing.

# create linodes
ansible-playbook linode_create.yml

# now wait some util they get up and running
# check inventory
ansible-inventory -i linode.yml --graph 

# you should get something like
> @all:
>  |--@group_demo:
>  |  |--demo-linode-1
>  |  |--demo-linode-2
>  |  |--demo-linode-3
>  |--@group_gateway_a:
>  |  |--demo-linode-1
>  |--@group_gateway_b:
>  |  |--demo-linode-2
>  |  |--demo-linode-3
>  |--@group_wireguard:
>  |  |--demo-linode-1
>  |  |--demo-linode-2
>  |  |--demo-linode-3
>  |--@ungrouped:


# ping the nodes just to check everything is ok so far
ansible -m ping group_demo -i linode.yml -u root


# run the main playbook to set up wireguard + nats between the servers
ansible-playbook -i linode.yml -u root playbook.yml

When you are done you clean up with

# this will destroy all created linodes
ansible-playbook linode_destroy.yml

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.