Skip to content

Commit 6ec2a37

Browse files
committed
Add multi apps features
1 parent e985615 commit 6ec2a37

19 files changed

+341
-70
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
packer
44
packer_cache
55
box
6-
*.iso
6+
.iso
77
*.box
88

99
# Sensitive datas
1010
install/config
11+
install/post-installation.sh

Makefile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
MAKEFLAGS += --no-print-directory
2+
.DEFAULT_GOAL := help
3+
ISOCHECKSUM=${shell curl http://mir.archlinux.fr/iso/${ARCHVERSION}/sha256sums.txt | grep "archlinux-x86_64.iso" | grep -Eo '^[0-9a-z]{64}'}
4+
TMPDIR=/var/tmp
5+
ARCHVERSION ?= 2022.10.01
6+
NAME = base
7+
8+
.POSIX:
9+
.PHONY: *
10+
11+
help: ## This help
12+
@find . -name Makefile -o -name "*.mk" | xargs -n1 grep -hE '^[a-z0-9\-]+:.* ##' | sed 's/\: .*##/:/g' | sort | column -ts':'
13+
14+
doc-generate: ## Generate main Readme commands list
15+
@make > /tmp/doc-generate.txt
16+
@bash -c 'export COMMANDS="$$(cat /tmp/doc-generate.txt)" ; envsubst < README.tpl > README.md'
17+
18+
toolkit: ## Homelab toolkit(for building a homelab stack)
19+
@command -v nix-shell > /dev/null && nix-shell --pure || docker run \
20+
--name homelab-admin \
21+
--rm \
22+
--interactive \
23+
--tty \
24+
--network host \
25+
--volume "/var/run/docker.sock:/var/run/docker.sock" \
26+
--volume $$(pwd):$$(pwd) \
27+
--volume ${HOME}/.ssh:/root/.ssh \
28+
--volume nixos-cache:/root/.cache \
29+
--volume nixos-nix:/nix \
30+
--workdir $$(pwd) \
31+
nixos/nix nix-shell
32+
33+
archlinux-versions: ## List all archlinux versions
34+
@curl -sL http://mir.archlinux.fr/iso/ | grep -Eo '20[0-9]{2}\.[0-9]{2}\.[0-9]{2}' | sort -u
35+
36+
.iso/archlinux-${ARCHVERSION}-x86_64.iso:
37+
mkdir -p ${ARCHVERSION} && wget -O .iso/archlinux-${ARCHVERSION}-x86_64.iso http://mir.archlinux.fr/iso/${ARCHVERSION}/archlinux-x86_64.iso
38+
39+
vagrant-build: .iso/archlinux-${ARCHVERSION}-x86_64.iso ## [ARCHVERSION] <NAME> Build vagrant box
40+
@cp config/${NAME}/* install/
41+
@echo "Building ${NAME} archlinux ${ARCHVERSION} version"
42+
@rm -rf box
43+
@TMPDIR=${TMPDIR} packer build \
44+
-var arch_version="${ARCHVERSION}" \
45+
-var arch_iso_checksum="${ISOCHECKSUM}" \
46+
-var outputname=${NAME} packer.pkr.hcl
47+
@NAME="${NAME}" vagrant box add --force archlinux-${NAME} file://./box/archlinux-${NAME}-${ARCHVERSION}-virtualbox.box
48+
49+
vagrant-up: ## Test vagrant box [ARCHVERSION] <NAME>
50+
@NAME="${NAME}" vagrant up
51+
52+
vagrant-ssh: ## Connect to vagrant box [ARCHVERSION] <NAME>
53+
@NAME="${NAME}" vagrant ssh
54+
55+
vagrant-destroy: ## Destroy vagrant box [ARCHVERSION] <NAME>
56+
@NAME="${NAME}" vagrant destroy
57+
58+
vagrant-push: ## Push vagrant box [ARCHVERSION] <NAME>
59+
@NAME="${NAME}" vagrant cloud publish \
60+
--force \
61+
--release \
62+
--no-private \
63+
--short-description "${NAME}+LUKS archlinux ${ARCHVERSION}" \
64+
badele/archlinux-${NAME} ${ARCHVERSION} virtualbox box/archlinux-${NAME}-${ARCHVERSION}-virtualbox.box

README.md

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,70 @@
11
# archlinux-auto-install
2-
Automatic installation of Archlinux for vagrants and physical hosts.
32

4-
This project install minimal Archlinux from scratch, other packages and configuration are done with **ansible**
3+
**DO NOT EDIT DIRECTLY THIS README.MD (edit the README.tpl)** and execute `make doc-generate`
54

5+
Automatic installation of Archlinux for vagrants and physical hosts.
66

7+
This project install minimal Archlinux from scratch, other packages and configuration are done with **ansible**
78

89
Image contains :
910
- Archlinux 2021.04.01
1011
- Encrypted LUKS disk (for vagrant, the password is `vagrant`)
11-
- btrfs partitions with sub volumes
1212
- `grub` and `grub-theme`
1313
- `networkmanager`
1414
- `yay` package (for installaling AUR packages)
1515
- `git` for clonning some project (ex: [ansible-archlinux](https://github.com/badele/ansible-archlinux))
1616
- `ansible` (for customize automatically your installation)
1717

18-
## Vagrant
18+
## Vagrant box
19+
20+
<table>
21+
<tr>
22+
<th>Logo</th>
23+
<th>Name</th>
24+
<th>Description</th>
25+
</tr>
26+
<tr>
27+
<td><img width="32" src="https://simpleicons.org/icons/archlinux.svg"></td>
28+
<td><a href="https://archlinux.org/">Archlinux</a></td>
29+
<td>Base Archlinux version</td>
30+
</tr>
31+
<tr>
32+
<td><img width="32" src="https://simpleicons.org/icons/ansible.svg"></td>
33+
<td><a href="https://www.ansible.com/">Ansible</a></td>
34+
<td>Archlinux + Ansible support</td>
35+
</tr>
36+
<tr>
37+
<td><img width="32" src="https://simpleicons.org/icons/nixos.svg"></td>
38+
<td><a href="https://nixos.org/">Nixos</a></td>
39+
<td>Archlinux + Nix support</td>
40+
</tr>
41+
</table>
42+
43+
## Help(commands)
44+
45+
```
46+
archlinux-versions List all archlinux versions
47+
doc-generate Generate main Readme commands list
48+
help This help
49+
toolkit Homelab toolkit(for building a homelab stack)
50+
vagrant-build [ARCHVERSION] <NAME> Build vagrant box
51+
vagrant-destroy Destroy vagrant box [ARCHVERSION] <NAME>
52+
vagrant-push Push vagrant box [ARCHVERSION] <NAME>
53+
vagrant-ssh Connect to vagrant box [ARCHVERSION] <NAME>
54+
vagrant-up Test vagrant box [ARCHVERSION] <NAME>
1955
```
20-
# From vagrant cloud
21-
vagrant init badele/ansiblearch && vagrant up
2256

23-
# From github
24-
export ARCHVERSION=2021.10.01
25-
mkdir -p ${ARCHVERSION} && wget -O ${ARCHVERSION}/archlinux-${ARCHVERSION}-x86_64.iso http://mir.archlinux.fr/iso/${ARCHVERSION}/archlinux-${ARCHVERSION}-x86_64.iso
26-
packer build -var-file config.pkrvars.hcl packer.pkr.hcl
27-
vagrant box add --force ansiblearch file://./box/ansiblearch-virtualbox.box
28-
vagrant up
29-
30-
# Push to vagrant cloud
31-
#vagrant cloud auth login
32-
ARCHVERSION=$(pcregrep -o1 'arch_version.*"(.*)"' config.pkrvars.hcl)
33-
vagrant cloud publish badele/ansiblearch ${ARCHVERSION} virtualbox box/ansiblearch-virtualbox.box -d "A LUKS+BTRFS ${ARCHVERSION} archlinux installation with ansible support"
57+
## Build
58+
59+
```
60+
make archlinux-versions
61+
make NAME=base vagrant-build
62+
make NAME=ansible vagrant-build
63+
make NAME=nix vagrant-build
64+
65+
make NAME=base vagrant-up
66+
make NAME=base vagrant-ssh
67+
make NAME=base vagrant-destroy
3468
```
3569

3670
## Host
@@ -55,6 +89,12 @@ vim install/config
5589
./install/install.sh
5690
```
5791

92+
## Usage
93+
```
94+
# From vagrant cloud
95+
vagrant init badele/ansiblearch && vagrant up
96+
```
97+
5898
## Use case
5999
Install 99% of Achlinux automatically, it installs it in less than two minutes.
60100
After installed the minimal arch, you can customized with `ansible` and `dotfiles`

README.tpl

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# archlinux-auto-install
2+
3+
**DO NOT EDIT DIRECTLY THIS README.MD (edit the README.tpl)** and execute `make doc-generate`
4+
5+
Automatic installation of Archlinux for vagrants and physical hosts.
6+
7+
This project install minimal Archlinux from scratch, other packages and configuration are done with **ansible**
8+
9+
Image contains :
10+
- Archlinux 2021.04.01
11+
- Encrypted LUKS disk (for vagrant, the password is `vagrant`)
12+
- `grub` and `grub-theme`
13+
- `networkmanager`
14+
- `yay` package (for installaling AUR packages)
15+
- `git` for clonning some project (ex: [ansible-archlinux](https://github.com/badele/ansible-archlinux))
16+
- `ansible` (for customize automatically your installation)
17+
18+
## Vagrant box
19+
20+
<table>
21+
<tr>
22+
<th>Logo</th>
23+
<th>Name</th>
24+
<th>Description</th>
25+
</tr>
26+
<tr>
27+
<td><img width="32" src="https://simpleicons.org/icons/archlinux.svg"></td>
28+
<td><a href="https://archlinux.org/">Archlinux</a></td>
29+
<td>Base Archlinux version</td>
30+
</tr>
31+
<tr>
32+
<td><img width="32" src="https://simpleicons.org/icons/ansible.svg"></td>
33+
<td><a href="https://www.ansible.com/">Ansible</a></td>
34+
<td>Archlinux + Ansible support</td>
35+
</tr>
36+
<tr>
37+
<td><img width="32" src="https://simpleicons.org/icons/nixos.svg"></td>
38+
<td><a href="https://nixos.org/">Nixos</a></td>
39+
<td>Archlinux + Nix support</td>
40+
</tr>
41+
</table>
42+
43+
## Help(commands)
44+
45+
```
46+
${COMMANDS}
47+
```
48+
49+
## Build
50+
51+
```
52+
make archlinux-versions
53+
make NAME=base vagrant-build
54+
make NAME=ansible vagrant-build
55+
make NAME=nix vagrant-build
56+
57+
make NAME=base vagrant-up
58+
make NAME=base vagrant-ssh
59+
make NAME=base vagrant-destroy
60+
```
61+
62+
## Host
63+
From booted archlinux live cd ([use ventoy](https://github.com/ventoy/Ventoy))
64+
65+
```
66+
# configure wireless
67+
iwctl device list
68+
iwctl station <device> scan
69+
iwctl station <device> get-networks
70+
iwctl station <device> connect <SSID>
71+
72+
# Clone
73+
rm -f /var/lib/pacman/sync/*.db
74+
pacman -Sy git
75+
git clone https://github.com/badele/archlinux-auto-install.git
76+
cd archlinux-auto-install
77+
78+
# Set installation configuration
79+
cp config/xxx > install/config
80+
vim install/config
81+
./install/install.sh
82+
```
83+
84+
## Usage
85+
```
86+
# From vagrant cloud
87+
vagrant init badele/ansiblearch && vagrant up
88+
```
89+
90+
## Use case
91+
Install 99% of Achlinux automatically, it installs it in less than two minutes.
92+
After installed the minimal arch, you can customized with `ansible` and `dotfiles`
93+
94+
- [ansible-archlinux](https://github.com/badele/ansible-archlinux)
95+
- [dotfiles](https://github.com/badele/dotfiles)
96+
97+
98+
## Thanks
99+
Thanks to zenithar for his documentation https://blog.zenithar.org/post/2020/04/01/archlinux-efi-ssd-luks2-lvm2-btrfs/
100+
101+
**Information for vagrant cloud project page**
102+
- [github archlinux-auto-install project](https://github.com/badele/archlinux-auto-install)
103+

Vagrantfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
# configures the configuration version (we support older styles for
66
# backwards compatibility). Please don't change it unless you know what
77
# you're doing.
8+
9+
name = ENV["NAME"]
10+
811
Vagrant.configure("2") do |config|
9-
config.vm.box = "ansiblearch"
12+
config.vm.box = "archlinux-" + name
1013
config.vm.provider "virtualbox" do |vb|
1114
vb.gui = true
1215
end

config.pkrvars.hcl

Lines changed: 0 additions & 2 deletions
This file was deleted.

config/ansible/config

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
INSTALL_MODE=vagrant # installation mode (vagrant|host)
3+
4+
# Disk & Partition
5+
DISK_TYPE=hdd # disk type (hdd|ssd)
6+
DISK=/dev/sda
7+
BOOT_PARTITION=/dev/sda1
8+
LUKS_PARTITION=/dev/sda2
9+
LUKS_PASSWORD=vagrant
10+
LUKS_NAME=archroot
11+
12+
# Grub
13+
GRUB_EFI_FALLBACK="--removable"
14+
GRUB_BOOT_NAME="Arch"
15+
16+
# Locale
17+
DEFAULT_LOCALE="fr_FR.UTF-8 UTF-8"
18+
DEFAULT_LANG="fr_FR.UTF-8"
19+
20+
# User & Host
21+
USER_NAME=vagrant
22+
USER_PASSWORD=vagrant
23+
USER_SHELL=zsh
24+
HOSTNAME=vagrant
25+
PACKAGES="intel-ucode grub-theme-vimix linux-firmware linux mkinitcpio hdparm util-linux networkmanager openssh ansible python-resolvelib"

config/ansible/post-installation.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
exit 0

config/vagrant.sample renamed to config/base/config

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ BOOT_PARTITION=/dev/sda1
88
LUKS_PARTITION=/dev/sda2
99
LUKS_PASSWORD=vagrant
1010
LUKS_NAME=archroot
11-
BTRFS_NAME=archroot
12-
BTRFS_OPTIONS=""
1311

1412
# Grub
1513
GRUB_EFI_FALLBACK="--removable"
@@ -24,6 +22,4 @@ USER_NAME=vagrant
2422
USER_PASSWORD=vagrant
2523
USER_SHELL=zsh
2624
HOSTNAME=vagrant
27-
28-
# Kernel
29-
CPU_TYPE=intel
25+
PACKAGES="intel-ucode grub-theme-vimix linux-firmware linux mkinitcpio hdparm util-linux networkmanager openssh"

config/base/post-installation.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
exit 0

0 commit comments

Comments
 (0)