2.2 KiB
2.2 KiB
setup hypervisor hosts
- AlmaLinux 8, minimal install
- LVM, root uses 30G, no home volume, all remaining disk provisioned by ceph
- 3 nodes - 192.168.140.1-3/24
- user: ansible, has password-less sudo and ssh keys setup
network
nmcli con add type ethernet ifname ens1 con-name ctlplane connection.autoconnect yes ip4 192.168.140.41/24 gw4 192.168.140.1 ipv4.dns 1.1.1.1,8.8.8.8 ipv4.dns-search local
nmcli con del ens1 && reboot
ansible user
groupadd -r -g 1001 ansible && useradd -r -u 1001 -g 1001 -m -s /bin/bash ansible ;\
echo "%ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ansible ;\
chmod 0440 /etc/sudoers.d/ansible ;\
passwd ansible ;\
hostnamectl set-hostname qemu01.local ;\
hostnamectl set-hostname --transient qemu01.local ;\
hostnamectl set-hostname --pretty qemu01 ;\
hostnamectl
ssh-copy-id -i ~/.ssh/id_rsa.pub ansible@192.168.140.41
setup python venv
Setup a venv the easy way.
sudo apt-get update
sudo apt-get install python3-dev libffi-dev gcc libssl-dev
sudo apt install python3-venv
mkdir -p /home/tseed/ansible/venv
python3 -m venv /home/tseed/ansible/venv
source /home/tseed/ansible/venv/bin/activate
setup ansible environment
install additional ansible galaxy collection
ansible-galaxy collection install community.general
record collections file for replicating this environment
nano -cw requirements.yml
collections:
- name: community.general
install requirements from file on new environment
ansible-galaxy collection install -r requirements.yml
ansible-galaxy collection install community.general --upgrade
dnf install sshpass / apt-get install sshpass
pip install jmespath
run playbook
start venv
source /home/tseed/ansible/venv/bin/activate
run hypervisor build playbook
This only builds hypervisors up to Ceph RBD, VM provisioning not complete
ansible-playbook bootstrap_hypervisors.yml
run dynamic roles from XCAT inventory for the various provisioned VMs
Used in production stack to provision various node classes, there are no real roles in this repo - just framework stuff and ntp/os_packages
ansible-playbook -l all site.yml