Ansible infrastructure for my homelab.
Software versions used by this repository:
| Package | Version |
|---|---|
| ansible | 9.13.0 |
| ansible-core | 2.16.14 |
| ansible-lint | 25.6.1 |
| python | 3.11 |
This repository uses Ansible version that requires Python 3.11.
Install required packages.
Use apt for Debian based systems:
sudo apt install -y python3.11 python3.11-pipUse yum for Red Hat based systems:
sudo yum install -y python3.11 python3.11-pip python3.11-netaddrUse pip in your selected Python environment to install the Ansible package of your choice for the current user:
TMPDIR="${HOME}/tmp" python3.11 -m pip install --user ansible==9.13.0 passlibAnsible Lint is a command-line tool for linting playbooks, roles and collection.
Note that ansible-core 2.12+ was made as a direct dependency with Ansible Lint release v6.0.0. This means that when you install the ansible-lint package >=v6.0.0, it also installs ansible-core and ansible packages as dependencies.
Package yamllint is installed as a dependency as well.
Install packages:
python3.11 -m pip install --user ansible-lint==25.6.1To use Ansible-lint with pre-commit, use the following command to create a pre-commit configuration file:
cat <<EOF > .pre-commit-config.yaml
- repo: https://github.com/ansible/ansible-lint
rev: v25.6.1
hooks:
- id: ansible-lint
files: \.(yaml|yml)$
EOFInstall pre-commit package:
python3.11 -m pip install --user pre-commit==3.3.3Enable pre-commit for the git repository:
pre-commit installServers built with Kickstart/Packer have root SSH keys pre-configured. If that is not the case, then see below.
Configure passwordless root SSH authentication from the device where Ansible is installed (e.g. your laptop):
ssh-copy-id -f -i ./roles/hl.users/files/id_rsa_root.pub root@10.11.1.XXCreate a file vault.key to store your Ansible Vault secret (see ansible.cfg for vault_password_file). Use Ansible Vault to create an encrypted file ./roles/hl.users/defaults/secure.yml to store your user password:
ansible-vault create ./roles/hl.users/defaults/secure.ymlThe variable for user password is user_password.
ansible-playbook ./playbooks/configure-pxe-hosts.yml --extra-vars "download_pxe_boot_media=true download_packer_media=true"ansible-playbook ./playbooks/configure-kvm-hosts.ymlansible-playbook ./playbooks/configure-admin-hosts.ymlPrepare Kubernetes hosts for cluster deployment:
ansible-playbook ./playbooks/configure-k8s-hosts.ymlConfigure Kubernetes cluster for the first time:
ansible-playbook ./playbooks/configure-k8s-cluster.ymlansible-playbook ./playbooks/configure-openvas-hosts.ymlansible-playbook ./playbooks/configure-dell-hosts.ymlThis is optional because of the local DNS server:
ansible-playbook ./playbooks/configure-hostsfile.ymlansible-playbook ./playbooks/configure-newrelic-hosts.ymlNote that user password for PXE boot Kickstart files is set to packer.

