Preparation
1. Populate your inventory
.inventory/{1-lxc, 2-services, 3-addons, 4-blockchains} files.testhost.homelab as follow:# .inventory/1-lxc
[lxc]
testhost.homelab
# .inventory/2-services
[gitea]
testhost.homelab
# .inventory/3-addons
[ohmyzsh]
testhost.homelab
This means that testhost.homelab can be auto-deployed as an lxc on proxmox, will install gitea, and oh-my-zsh
will be the default shell for the provided users.
2. Prepare a Proxmox Node
In the case that you want to be able to auto-deploy LXC containers on proxmox, you need to first generate the template folder for the node using the following:
ansible-playbook playbooks/generate_node.yml -e "node_name=<your_node_name_here>"
This will create a folder like this:
proxmox_nodes
└── your_node_name_here
├── .token
└── main.yml
You can then add your token into the encrypted .token file using:
ansible-vault edit proxmox_nodes/your_node_name_here/.token
the main.yml file contains the token id, node url, and the ansible user public key. Fill those in as well.
3. Prepare your hosts
With the inventory populated you can generate the templates required to deploy your hosts using the following:
ansible-playbook playbooks/generate_hostvars.yml
What this does is populate the host_vars folder with templates for the various required
variables. In the case of testhost.homelab showed in step 1 this would create a
folder like so:
inventory
└── host_vars
└── testhost.homelab
├── lxc.yml
├── ohmyzsh.yml
├── .credentials.yml
└── files
└── gitea.app.ini.j2
Fill the content according to the appropriate pages on the left.
Important
If you’re using multiple services that uses .credentials, only the first template is
copied over. You can get the content of the others in global_files/host_secret_templates
4. Fill in your global variables
A file is provided under inventory/group_vars/all.yml that contains various useful
variables that needs to be filled
timezoneRequired
The timezone that will be used on your deployed container or some services
additional_user_key_pairOptional
dict
format: {user: public_ssh_key}
users to be added to deployed containers
ansible_pubkeyRequired
Public key for the default ansible user. Used to bootstrap lxc container
default_lxc_imageRequired
default CT template to deploy lxc container, changing this can and will break the work flow but it should be an easy-fix™
default_netif_configRequired
default netif configuration to deploy lxc container