summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 205815d82b66eca3ce0ea782dc550ed734c4993c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Ansible Linux Distro Install

Ansible roles and playbooks to install different linux distros.

## Prerequisite

- [Ansible][ansible]
- [`sshpass`][sshpass] **required** for `--ask-pass`
- [`git-crypt`][git-crypt] **optional** for keeping encrypted configurations.

[sshpass]: https://man.freebsd.org/cgi/man.cgi?query=sshpass
[ansible]: https://docs.ansible.com/ansible/latest/index.html
[git-crypt]: https://github.com/AGWA/git-crypt

If you are using `git-crypt`, setup your key, and override the encrypted files (`host_vars/*.yml`)
with your own version.

If you are not using `git-crypt`, delete the `.gitattributes` file and override the encrypted files
with your own version.
Ex. `rm .gitattributes && cp host_vars/ubuntuiso.local.yml.example host_vars/ubuntuiso.local.yml`

## Boot distro live image

- [Arch Linux](./archlinux.md)
- [Debian Ubuntu](./ubuntu.md)
- [Raspberry PI 5](./raspberry.md)

## Playbook: distro-install

- Follow the pre-install guides for desired distro in "Boot distro live image"
- Install ansible required dependencies
- Configure the desired `host_vars` in this playbook
- Run the playbook

**Example**:

```bash
git clone https://git.sr.ht/~a14m/ansible-distro-install /opt/distro-install
cp /opt/distro-install/host_vars/${DISTRO}iso.local.yml.example /opt/distro-install/host_vars/${DISTRO}iso.local.yml

cd /opt/distro-install
ansible-galaxy install -r requirements.yml

ansible-playbook site.yml --ask-pass
```

## Playbook: distro-configure

- Clone the [`distro-configure`](https://git.sr.ht/~a14m/ansible-distro-configure) playbook
- Configure the desired `host_vars` in the `distro-configure` playbook
- Run the playbook with `configure_playbook_dir` variable

**Example**:

```bash
git clone https://git.sr.ht/~a14m/ansible-distro-install /opt/distro-install
cp /opt/distro-install/host_vars/${DISTRO}iso.local.yml.example /opt/distro-install/host_vars/${DISTRO}iso.local.yml

git clone https://git.sr.ht/~a14m/ansible-distro-configure /opt/distro-configure
cp /opt/distro-configure/host_vars/${DISTRO}.local.yml.example /opt/distro-configure/host_vars/${DISTRO}.local.yml

cd /opt/distro-install
ansible-galaxy install -r requirements.yml

ansible-playbook site.yml --ask-pass --extra-vars '{"configure_playbook_dir":"/opt/distro-configure"}'
```

## Special Thanks to

- [Jeff Geerling](https://www.jeffgeerling.com/), who I learned a **LOT** from his open-source work.