diff options
author | Jesse Luehrs <doy@tozt.net> | 2018-11-15 23:32:18 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2018-11-15 23:32:18 -0500 |
commit | 7534164b2bb5ba46b698908d00a1a4dc43a4fe19 (patch) | |
tree | dcfb857092cc6903e27b34a314f60b56602b9dc3 | |
parent | 672d557949496189db879f6a63ce0a0947bb7785 (diff) | |
download | puppet-tozt-7534164b2bb5ba46b698908d00a1a4dc43a4fe19.tar.gz puppet-tozt-7534164b2bb5ba46b698908d00a1a4dc43a4fe19.zip |
manage mdadm.conf and mkinitcpio.conf with puppet
-rwxr-xr-x | bin/helpers/launch-partofme | 7 | ||||
-rw-r--r-- | manifests/partofme.pp | 2 | ||||
-rw-r--r-- | modules/partofme/files/mdadm.conf | 3 | ||||
-rw-r--r-- | modules/partofme/files/mkinitcpio.conf | 4 | ||||
-rw-r--r-- | modules/partofme/manifests/mdadm.pp | 10 | ||||
-rw-r--r-- | modules/partofme/manifests/operatingsystem.pp | 10 |
6 files changed, 32 insertions, 4 deletions
diff --git a/bin/helpers/launch-partofme b/bin/helpers/launch-partofme index aa857be..9567022 100755 --- a/bin/helpers/launch-partofme +++ b/bin/helpers/launch-partofme @@ -17,10 +17,9 @@ copy() { scp -r $ssh_opts "$1" root@"$host":"$2" } -# configure the mdadm arrays -run "echo 'ARRAY /dev/md2 metadata=0.90 UUID=6bf2e365:10a7910f:52419904:51489ef3' >> /etc/mdadm.conf" -# detect the persistent disks properly on boot -run "sed -i 's/^HOOKS=(base udev.*block /&mdadm encrypt lvm2 /' /etc/mkinitcpio.conf" +# configure the persistent disks properly at boot +copy "$(dirname "$0")"/../../modules/partofme/files/mdadm.conf /etc/mdadm.conf +copy "$(dirname "$0")"/../../modules/partofme/files/mkinitcpio.conf /etc/mkinitcpio.conf # ensure we have the latest linux version, otherwise wireguard will fail to # build and install the correct kernel modules run "pacman -Syu --noconfirm" diff --git a/manifests/partofme.pp b/manifests/partofme.pp index 5390bbd..332623d 100644 --- a/manifests/partofme.pp +++ b/manifests/partofme.pp @@ -5,5 +5,7 @@ node 'partofme.localdomain' { include partofme::backups include partofme::filesharing + include partofme::mdadm include partofme::monitoring + include partofme::operatingsystem } diff --git a/modules/partofme/files/mdadm.conf b/modules/partofme/files/mdadm.conf new file mode 100644 index 0000000..beda4a9 --- /dev/null +++ b/modules/partofme/files/mdadm.conf @@ -0,0 +1,3 @@ +DEVICE partitions +ARRAY /dev/md2 metadata=0.90 UUID=6bf2e365:10a7910f:52419904:51489ef3 +ARRAY /dev/md/data metadata=1.2 name=partofme:data UUID=1beb6211:1f58dd1c:2d13ea0a:0684516d diff --git a/modules/partofme/files/mkinitcpio.conf b/modules/partofme/files/mkinitcpio.conf new file mode 100644 index 0000000..c3fedc4 --- /dev/null +++ b/modules/partofme/files/mkinitcpio.conf @@ -0,0 +1,4 @@ +MODULES=() +BINARIES=() +FILES=() +HOOKS=(base udev autodetect modconf block mdadm encrypt lvm2 filesystems keyboard fsck) diff --git a/modules/partofme/manifests/mdadm.pp b/modules/partofme/manifests/mdadm.pp new file mode 100644 index 0000000..d317e1a --- /dev/null +++ b/modules/partofme/manifests/mdadm.pp @@ -0,0 +1,10 @@ +class partofme::mdadm { + file { '/etc/mdadm.conf': + source => 'puppet:///modules/partofme/mdadm.conf', + notify => Exec['/usr/bin/mdadm --assemble --scan']; + } + + exec { '/usr/bin/mdadm --assemble --scan': + refreshonly => true; + } +} diff --git a/modules/partofme/manifests/operatingsystem.pp b/modules/partofme/manifests/operatingsystem.pp new file mode 100644 index 0000000..e645c87 --- /dev/null +++ b/modules/partofme/manifests/operatingsystem.pp @@ -0,0 +1,10 @@ +class partofme::operatingsystem { + file { '/etc/mkinitcpio.conf': + source => 'puppet:///modules/partofme/mkinitcpio.conf', + notify => Exec['/usr/bin/mkinitcpio -p linux']; + } + + exec { '/usr/bin/mkinitcpio -p linux': + refreshonly => true; + } +} |