Git Product home page Git Product logo

home-lab-as-code's Introduction

Home Lab As Code

The code in this repository will:

  • generate cloud-init ready rhel images for rhel8 and rhel9 (or other rhel based distributions).
  • automates the provisioning of virtual machines via terraform.
  • the dnsmasq configuration wil make the virtual machines resolvable via from the local machine.

Tested on Red Hat Enterprise Linux release 9.0 (Plow)

Generate and download content

Download ISO files

Download the needed rhel iso files and put them in the packer/iso-files directory.
(check the rhel8.pkr.hcl and rhel9.pkr.hcl packer config files what iso files are needed).

Build packer images

$ cd packer/<rhel_version>
$ packer init .
$ packer build .

Configure libvirt

The libvirt configuration is based on the following instructions:
howto-automated-dns-resolution-for-kvmlibvirt-guests-with-a-local-domain.
This configuration uses home.arpa for the domain name. (see rfc8375).

Edit libvirt local domain

Check the current network configuration of the default network.

$ sudo virsh net-dumpxml default
<network connections='1'>
  <name>default</name>
  <uuid>158880c3-9adb-4a44-ab51-d0bc1c18cddc</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:fa:cb:e5'/>
  <domain name='home.arpa' localOnly='yes'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.128' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

Make sure this contains the following configuration:

<domain name='home.arpa' localOnly='yes'/>

Configure via:

virsh net-edit default

Configure dns masquerading

$ cat /etc/NetworkManager/conf.d/localdns.conf 
[main]
dns=dnsmasq
$ cat /etc/NetworkManager/dnsmasq.d/libvirt_dnsmasq.conf
server=/home.arpa/192.168.122.1
sudo systemctl restart NetworkManager

Configure and use terraform

Steps:

  • Install terraform.
  • Configure the required virtual machines and sizing in terraform/variables.tf.
  • terraform init, plan and apply the configuration.
$ cd terraform
$ terraform init
$ terraform plan
$ terraform apply

home-lab-as-code's People

Contributors

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