Code Monkey home page Code Monkey logo

homelab-iac-ansible's Introduction

homelab-iac-ansible

Full homelab infrastructure using ansible

Requisites

  • A node with Proxmox VE installed - described in inventory/hosts as pve01
  • Control node with shh & python & ansible installed

First time setup steps

  1. generate your own ssh key at ./ssh-keys
    1. ssh-keygen -f homelab
  2. Add the recently generated key to ssh-agent
    1. ssh-add ssh-keys/homelab
  3. Setup your own vault for pve01
    1. ansible-vault create inventory/host_vars/pve01/vault
    2. Add the following line to the file and save vault_api_password: <your own password>

Playbooks

Create infrastructure

ansible-playbook main.yml -i inventory

Modify infrastructure

This will update container configs on all managed nodes.

ansible-playbook edit.yml -i inventory

Edit only the nodes managed by pve01 named dns01

ansible-playbook edit.yml -i inventory --limit pve01,dns01

Delete infrastructure

This will delete all managed nodes.

ansible-playbook nuke.yml -i inventory

Delete only the nodes managed by pve01 named dns01

ansible-playbook nuke.yml -i inventory --limit pve01,dns01

Report whole infrastructure

ansible-playbook csv_export.yml -i inventory

Run through docker instructions

Build image

docker build -t ansible:latest .

Run image

docker run -it --name=ansible ansible:latest

Handy one liner

docker build -t ansible:latest . && docker image prune -f && docker rm ansible; docker run -it --name=ansible ansible:latest

Test connections

ansible all -m ping

Add a new host steps

  1. Create entry at inventory/host_vars/host01/host01.yml
  2. Create task file at tasks/host01.yml
  3. Append host at inventory/hosts
  4. Append host at files/pihole/custom.list
  5. Run ansible-playbook create.yml -i inventory --limit pve01,host01
  6. (optional) Append routes for host01 at files/haproxy/haproxy.cfg
    1. Run ansible-playbook create.yml -i inventory --limit haproxy01

homelab-iac-ansible's People

Contributors

adelinofaria avatar favonia 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.