Coder Social home page Coder Social logo

homelab-infra's Introduction

This is my Homelab infrastructure.

Requirements

  • Ansible (version >= 2.9.6)
    • Python3 and Pip
  • Packer (version >= 1.6.0)
  • Terraform (version >= 0.12.28)
    • Terragrunt (version >= 0.23.29)

Fill ansible/secrets.yml based on ansible/secrets.example and encrypt the file with ansible-vault

Ansible

cd ansible

Install dependencies pip3 install -r requirements.txt

fill all secrets.yml based on secrets.example in each subdirectory of groups_vars

Playbooks to add fingerprint on know_hosts

ansible-playbook -i <inventory_file> playbooks/add-ssh-keys.yml

Playbooks to deploy SSH configuration

ansible-playbook -i <inventory_file> playbooks/deploy_authorized_keys.yml

Playbooks to deploy dmz

ansible-playbook -i dmz deploy_dmz.yml

Playbooks to deploy lab

ansible-playbook -i lab deploy_lab.yml

Packer

Port 8888 used for debian build Port 8889 used for ubuntu build

Open both ports on windows firewall
Start powershell prompt with admin right netsh interface portproxy add v4tov4 listenport=<PORT> listenaddress=<IP> connectport=<PORT> connectaddress=127.0.0.1
Replace with the LAN IP of your PC and with [8888, 8889] To delete the rules netsh interface portproxy del v4tov4 listenport=<PORT> listenaddress=<IP>

cd packer

Supported distributions :

  • Debian (10.4.0) - iso
  • Ubuntu (20.04) - iso

Create template

Linux : ./build.sh
Windows : ./build.ps1

Validate syntax template

Linux : ./validate.sh
Windows : ./validate.ps1

Terraform

cd terraform

Install dependencies < packages.txt xargs sudo apt-get install -y

fill account.hcl based on account.example

Infrastructure is split in 2 parts :

  • dmz
  • lab

Command must be run in one of this two directories (dmz/lab)

Create an execution plan

terragrunt plan-all

Deploy/update infrastructure

terragrunt apply-all

Credits

Copyright © Ludovic Ortega, 2019

Contributor(s):

-Ortega Ludovic - [email protected]

homelab-infra's People

Contributors

m0nsterrr 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.