ansible: Manage libvirt on CI 'hosts'
[lttng-ci.git] / automation / ansible / README.md
CommitLineData
e689666c
MJ
1# Setup on Ubuntu
2
3```
4apt install ansible ansible-mitogen
5```
6
83d6ed6c
KS
7# Required collections
8
9```
fc7346bb 10ansible-galaxy install -r roles/requirements.yml
83d6ed6c
KS
11```
12
13# Privileged data
14
15Privileged data is stored in Bitwarden. To use roles that fetch privileged data,
16the following utilities must be available:
17
18* [bw](https://bitwarden.com/help/cli/)
19
20Once installed, login and unlock the vault:
21
22```
23bw login # or, `bw unlock`
24export BW_SESSION=xxxx
25bw sync -f
26```
27
28# Running playbooks
29
30```
31ansible-playbook -i hosts [-l SUBSET] site.yaml
32```
d82e5cee
KS
33
34# Bootstrapping hosts
35
36## Windows
37
381. Configure either SSH or WinRM connection: see https://docs.ansible.com/ansible/latest/os_guide/windows_setup.html
392. For arm64 hosts:
40 * Install the necessary optional features (eg. OpenSSH, Hyper-V) since Windows RSAT isn't available on Arm64 yet
4be44748
KS
41
42## CI 'rootnode'
43
441. Add an entry to the `vms` variable in the host vars for a libvirt host
45 * See the defaults and details in `roles/libvirt/vars/main.yml` and `roles/libvirt/tasks/main.yml`
46 * Make sure to set the `cdrom` key to the path of ISO for the installer
472. Run the playbook, eg. `ansible-playbook -i hosts -l cloud07.internal.efficios.com site.yml`
48 * The VM should be created and started
493. Once the VM is installed take a snapshot so that Jenkins may revert to the original state
50
51### Ubuntu auto-installer
52
531. Note your IP address
542. Switch to the directory with the user-data files: `cd roles/libvirt/files`
553. Write out the instance-specific metadata, eg.
56
57```
58cat > meta-data <<EOF
59instance-id: iid-XXX
60hostname: XXX.internal.efficios.com
61EOF
62```
63 * The instance-id is used to determine if re-installation is necessary.
644. Start a python web server: `python3 -m http.server 3003`
655. Connect to the VM using a remote viewer on the address given by `virsh --connect qemu+ssh://root@host/system domdisplay`
666. Edit the grub boot options for the installer and append the following as arguments for the kernel: `autoinstall 'ds=nocloud-net;s=http://IPADDRESS:3003/'` and boot the installer
67 * Note that the trailing `/` and quoting are important
68 * The will load the `user-data`, `meta-data`, and `vendor-data` files in the directory served by the python web server
697. After the installation is complete, the system will reboot and run cloud-init for the final portion of the initial setup. Once completed, ansible can be run against it using the ubuntu user and becoming root, eg. `ansible-playbook -i hosts -u ubuntu -b ...`
This page took 0.02443 seconds and 4 git commands to generate.