jjb: babeltrace: use clang-format-16
[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 ...`
c3c15dc7
KS
70
71# LXD Cluster
72
73## Start a new cluster
74
751. For the initial member of the cluster, set the `lxd_cluster` variable in the host variables to something similar to:
76
77```
78lxd_cluster:
79 server_name: cluster-member-name
80 enabled: true
81 member_config:
82 - entity: storage-pool
83 name: default
84 key: source
85 value: tank/lxd
86```
87
882. Run the `site.yml` playbook on the node
893. Verify that storage pool is configured:
90
91```
92$ lxc storage list
93| name | driver | state |
94| default | zfs | created |
95```
96
97 * If not present, create it on necessary targets:
98
99```
100$ lxc storage create default zfs source=tank/lxd --target=cluster-member-name
101# Repeat for any other members
102# Then, on the member itself
103$ lxc storage create default zfs
104# The storage listed should not be in the 'pending' state
105```
106
1074. Create a metrics certificate pair for the cluster, or use an existing one
108
109```
110openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 -sha384 -keyout metrics.key -nodes -out metrics.crt -days 3650 -subj "/CN=metrics.local"
111lxc config trust add metrics.crt --type=metrics
112```
113
114## Adding a new host
115
1161. Generate a token for the new member: `lxc cluster add member-host-name`
1172. In the member's host_var's file set the following key:
118 * `lxd_cluster_ip`: The IP address on which the server will listen
119 * `lxd_cluster`: In a fashion similar to the following entry
120```
121lxd_cluster:
122 enabled: true
123 server_address: 172.18.0.192
124 cluster_token: 'xxx'
125 member_config:
126 - entity: storage-pool
127 name: default
128 key: source
129 value: tank/lxd
130```
131 * The `cluster_token` does not need to be kept in git after the the playbook's first run
1323. Assuming the member is in the host's group of the inventory, run the `site.yml` playbook.
133
134## Managing instances
135
136Local requirements:
137
138 * python3, python3-dnspython, samba-tool, kinit
139
140To automatically provision instances, perform certain operations, and update DNS entries:
141
1421. Update `vars/ci-instances.yml`
1432. Open a kerberos ticket with `kinit`
455bd8ef 1443. Run the playbook, eg. `ansible-playbook playbooks/ci-instances.yml`
This page took 0.029972 seconds and 4 git commands to generate.