Commit | Line | Data |
---|---|---|
e689666c MJ |
1 | # Setup on Ubuntu |
2 | ||
3 | ``` | |
4 | apt install ansible ansible-mitogen | |
5 | ``` | |
6 | ||
83d6ed6c KS |
7 | # Required collections |
8 | ||
9 | ``` | |
fc7346bb | 10 | ansible-galaxy install -r roles/requirements.yml |
83d6ed6c KS |
11 | ``` |
12 | ||
13 | # Privileged data | |
14 | ||
15 | Privileged data is stored in Bitwarden. To use roles that fetch privileged data, | |
16 | the following utilities must be available: | |
17 | ||
18 | * [bw](https://bitwarden.com/help/cli/) | |
19 | ||
20 | Once installed, login and unlock the vault: | |
21 | ||
22 | ``` | |
23 | bw login # or, `bw unlock` | |
24 | export BW_SESSION=xxxx | |
25 | bw sync -f | |
26 | ``` | |
27 | ||
28 | # Running playbooks | |
29 | ||
30 | ``` | |
31 | ansible-playbook -i hosts [-l SUBSET] site.yaml | |
32 | ``` | |
d82e5cee KS |
33 | |
34 | # Bootstrapping hosts | |
35 | ||
36 | ## Windows | |
37 | ||
38 | 1. Configure either SSH or WinRM connection: see https://docs.ansible.com/ansible/latest/os_guide/windows_setup.html | |
39 | 2. 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 | ||
44 | 1. 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 | |
47 | 2. Run the playbook, eg. `ansible-playbook -i hosts -l cloud07.internal.efficios.com site.yml` | |
48 | * The VM should be created and started | |
49 | 3. Once the VM is installed take a snapshot so that Jenkins may revert to the original state | |
50 | ||
51 | ### Ubuntu auto-installer | |
52 | ||
53 | 1. Note your IP address | |
54 | 2. Switch to the directory with the user-data files: `cd roles/libvirt/files` | |
55 | 3. Write out the instance-specific metadata, eg. | |
56 | ||
57 | ``` | |
58 | cat > meta-data <<EOF | |
59 | instance-id: iid-XXX | |
60 | hostname: XXX.internal.efficios.com | |
61 | EOF | |
62 | ``` | |
63 | * The instance-id is used to determine if re-installation is necessary. | |
64 | 4. Start a python web server: `python3 -m http.server 3003` | |
65 | 5. Connect to the VM using a remote viewer on the address given by `virsh --connect qemu+ssh://root@host/system domdisplay` | |
66 | 6. 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 | |
69 | 7. 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 ...` |