My goals for this project are the following
- Understand the basics of Ansible (Inventory, Playbook, Task, Module)
- Create an inventory for my hosts
- Create a playbook
- Variables and templates
- Provision and build proxmox VMs
24th may 2026
Ansible is a management tool used in Home labs and infrastructures to maintain a consistent environment.
24th may 2026
24th may 2026
I started off by downloading Ansible on my desktop which later I can move to a server
╭─hamish@hamish in ~
╰─λ sudo pacman -S ansible
[sudo] password for hamish:
resolving dependencies...
looking for conflicting packages...
Package (14) New Version Net Change Download Size
extra/ansible-core 2.21.0-1 24.01 MiB 3.60 MiB
extra/python-bcrypt 5.0.0-2 0.49 MiB 0.20 MiB
extra/python-cffi 2.0.0-2 1.38 MiB 0.28 MiB
extra/python-cryptography 48.0.0-1 6.58 MiB 1.47 MiB
extra/python-fluidity 0.2.1-8 0.05 MiB 0.01 MiB
extra/python-invoke 3.0.3-1 1.05 MiB 0.19 MiB
extra/python-jinja 1:3.1.6-3 2.04 MiB 0.32 MiB
extra/python-lexicon 3.0.0-2 0.03 MiB 0.01 MiB
extra/python-markupsafe 3.0.3-1 0.09 MiB 0.02 MiB
extra/python-paramiko 4.0.0-2 2.37 MiB 0.36 MiB
extra/python-pycparser 3.00-1 0.71 MiB 0.11 MiB
extra/python-pynacl 1.6.2-1 1.01 MiB 0.12 MiB
extra/python-resolvelib 1.2.1-2 0.19 MiB 0.04 MiB
extra/ansible 13.7.0-1 559.39 MiB 41.48 MiB
Total Download Size: 48.23 MiB
Total Installed Size: 599.40 MiB
:: Proceed with installation? [Y/n] y
I also created a github repo to keep my playbooks on.
https://github.com/IWantSome314/ansible-playbook
This will be used to store my playbooks so I can move it to a VM once I think its worth to do so.
I have created a inventory.yml to set my hosts in that I will use my ansible playbooks on
I aswell have created a vault to keep secrets in ansible-vault create group_vars/all/vault.yml and aswell as a gitignore just cause I dont want my vault file even tho encrypted to be on my git repo.
╭─hamish@hamish in repo: ansible-playbook on main [?] took 0s
╰─λ ls
drwxr-xr-x - hamish 24 May 21:57 .git
drwxr-xr-x - hamish 24 May 22:40 group_vars
.rw-r--r-- 54 hamish 24 May 22:13 ansible.cfg
.rw-r--r-- 25 hamish 24 May 22:39 gitginore
.rw-r--r-- 239 hamish 24 May 22:36 inventory.yml
.rw-r--r-- 56 hamish 24 May 21:32 readme.md
╭─hamish@hamish in repo: ansible-playbook on main [?] took 0s
╰─λ ls group_vars/all/
.rw------- 808 hamish 24 May 22:41 vault.yml
╭─hamish@hamish in repo: ansible-playbook on main [?] took 0s
╰─λ 24th may 2026
I started to create an inventory with a few of my already exsisting VMs. And just tested a ping
all:
children:
management:
hosts:
slt-01:
k3s-man-01:
k3s:
hosts:
k3s-man-01:
k3s-wrk-01:
k3s-wrk-02:
╰─λ ansible all -m ping -i inventory.yml
Vault password:
[WARNING]: Host 'k3s-wrk-02' is using the discovered Python interpreter at '/usr/bin/python3.12', but future installation of another Python interpreter could cause a different interpreter to be discovered. See https://docs.ansible.com/ansible-core/2.21/reference_appendices/interpreter_discovery.html for more information.
k3s-wrk-02 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3.12"
},
"changed": false,
"ping": "pong"
}
[WARNING]: Host 'k3s-wrk-01' is using the discovered Python interpreter at '/usr/bin/python3.12', but future installation of another Python interpreter could cause a different interpreter to be discovered. See https://docs.ansible.com/ansible-core/2.21/reference_appendices/interpreter_discovery.html for more information.
k3s-wrk-01 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3.12"
},
"changed": false,
"ping": "pong"
}
[WARNING]: Host 'k3s-man-01' is using the discovered Python interpreter at '/usr/bin/python3.12', but future installation of another Python interpreter could cause a different interpreter to be discovered. See https://docs.ansible.com/ansible-core/2.21/reference_appendices/interpreter_discovery.html for more information.
k3s-man-01 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3.12"
},
"changed": false,
"ping": "pong"
}
[WARNING]: Host 'slt-01' is using the discovered Python interpreter at '/usr/bin/python3.12', but future installation of another Python interpreter could cause a different interpreter to bediscovered. See https://docs.ansible.com/ansible-core/2.21/reference_appendices/interpreter_discovery.html for more information.
slt-01 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3.12"
},
"changed": false,
"ping": "pong"
}
I then wanted to set some vars for a base user and port to use so I created a vault to store my secrets in.
ansible-vault create group_vars/all/vault.yml
I then called my set secrets/vars in my inventory
all:
vars:
ansible_user: "{{ vault_ansible_user }}"
ansible_port: "{{ vault_ansible_port }}"
children:
management:
hosts:
slt-01:
k3s-man-01:
k3s:
hosts:
k3s-man-01:
k3s-wrk-01:
k3s-wrk-02:
I have no gone through and added most of my servers. Ones that I want managed maybe Ill add the rest later depending how far I take ansible.
26th may 2026
Since ansible works agentless. I will need to set up my ssh key onto my servers for the my ansible user. I am creating a playbook that will do this but it wont work till I do it manually first anyway but my reason for doing this is because later I can change this playbook to a SSH key from my desktop to the each of the servers onces I make a vm to use my ansible host.
I made a folder /playbooks which if it isnt obvious is where I will store my playbooks. Maybe I will organise later if needed but for now Ive created a file called ssh_key.yml
---
- name: Push ssh keys to hosts
hosts: all # Specifying the hosts in this case everything
become: true # Become true escalates the script/process/task or what ever as a privileged user /root
tasks:
- name: create .ssh dir if needed
file: # Ansible builtin module to specify we are working with a file or later specified a directory. Using this it checks if the file exists if so theres nothing to do if not then it will create the file
path: /home/{{ vault_ansible_user }}/.ssh # Specify the directory we are checking
state: directory # Specifies the expected state of the target
mode: '0700'
owner: "{{ vault_ansible_user }}"
group: "{{ vault_ansible_user }}"
- name: Push ssh keys
authorized_key: # Ansible ssh key module
user: "{{ vault_ansible_user }}"
state: present # Stating we want the key to be present for mentioned user
key: "{{ lookup('file', '~/.ssh/id_ed25519.pub') }}" # Setting the source/location of the key