diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-16 00:22:38 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-16 18:08:12 +0100 |
commit | c15f2234474ff8a8266e26856702b3c561050667 (patch) | |
tree | 5df6dfb44ee2d37fbd9cf7b701bdc7881c575857 /scripts/ovh_cloud_instance | |
parent | 985b53a258ee18eaca8d437ae532c232a6d19921 (diff) | |
download | Puppet-c15f2234474ff8a8266e26856702b3c561050667.tar.gz Puppet-c15f2234474ff8a8266e26856702b3c561050667.tar.zst Puppet-c15f2234474ff8a8266e26856702b3c561050667.zip |
Move scripts to separate chunks
Diffstat (limited to 'scripts/ovh_cloud_instance')
-rwxr-xr-x | scripts/ovh_cloud_instance/arch_host_puppet_configuration_script.sh | 11 | ||||
-rwxr-xr-x | scripts/ovh_cloud_instance/arch_host_script.sh | 50 |
2 files changed, 61 insertions, 0 deletions
diff --git a/scripts/ovh_cloud_instance/arch_host_puppet_configuration_script.sh b/scripts/ovh_cloud_instance/arch_host_puppet_configuration_script.sh new file mode 100755 index 0000000..b58e255 --- /dev/null +++ b/scripts/ovh_cloud_instance/arch_host_puppet_configuration_script.sh | |||
@@ -0,0 +1,11 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | git_branch="$1" | ||
4 | environment="$2" | ||
5 | |||
6 | MOUNTPOINT=/mnt | ||
7 | |||
8 | sudo cp /tmp/arch_puppet_configuration_script.sh "$MOUNTPOINT/root/" | ||
9 | |||
10 | sudo arch-chroot "$MOUNTPOINT" /root/arch_puppet_configuration_script.sh "$git_branch" "$environment" | ||
11 | |||
diff --git a/scripts/ovh_cloud_instance/arch_host_script.sh b/scripts/ovh_cloud_instance/arch_host_script.sh new file mode 100755 index 0000000..c188514 --- /dev/null +++ b/scripts/ovh_cloud_instance/arch_host_script.sh | |||
@@ -0,0 +1,50 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | set -e | ||
4 | |||
5 | git_branch="$1" | ||
6 | environment="$2" | ||
7 | |||
8 | # Randomizer | ||
9 | sudo haveged & | ||
10 | # /Randomizer | ||
11 | |||
12 | # Prepare an arch chroot | ||
13 | sudo pacman -Sy --noconfirm arch-install-scripts | ||
14 | # /Prepare an arch chroot | ||
15 | |||
16 | # Prepare device information | ||
17 | DEVICE=/dev/vdb1 | ||
18 | MOUNTPOINT=/mnt | ||
19 | |||
20 | UUID=$(lsblk -rno UUID "$DEVICE") | ||
21 | PART="/dev/disk/by-uuid/$UUID" | ||
22 | # /Prepare device information | ||
23 | |||
24 | # Install very basic system (base git puppet) | ||
25 | # mkfs.ext4 -F -U "$UUID" "$DEVICE" | ||
26 | sudo mount "$DEVICE" /mnt | ||
27 | |||
28 | ##### FIXME: mkfs.ext4 would be better #### | ||
29 | for i in /mnt/*; do | ||
30 | if [ "$i" = "/mnt/boot" ]; then | ||
31 | # keep /boot/grub | ||
32 | sudo rm -f $i/* | ||
33 | else | ||
34 | sudo rm -rf $i | ||
35 | fi | ||
36 | done | ||
37 | ##### /FIXME #### | ||
38 | |||
39 | sudo pacstrap /mnt base git puppet | ||
40 | |||
41 | echo "$PART / auto defaults 0 1" | sudo tee /mnt/etc/fstab | ||
42 | # /Install very basic system | ||
43 | |||
44 | # Install rest of system (via puppet) | ||
45 | sudo cp /tmp/arch_install_script.sh "$MOUNTPOINT/root/" | ||
46 | sudo cp /tmp/puppet_variables.json "$MOUNTPOINT/root/" | ||
47 | |||
48 | sudo arch-chroot "$MOUNTPOINT" /root/arch_install_script.sh "$git_branch" "$environment" | ||
49 | # /Install rest of system | ||
50 | |||