]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/ovh_cleanup/manifests/init.pp
Install OVH vps from scratch
[perso/Immae/Projets/Puppet.git] / modules / ovh_cleanup / manifests / init.pp
index de16cb4a2a801aab4ec4c5a856653fb959c09a3e..fc1b84b308696124ebef0d3e1524c4b8c3fcbbf3 100644 (file)
@@ -1,4 +1,12 @@
 class ovh_cleanup {
+    exec { 'bash -c "comm -23 <(find /etc /opt /usr | sort) <(pacman -Qlq | sed \"s|/$||\" | sort) > /root/disowned_files_before_cleanup.txt"':
+      path    => '/usr/bin',
+      creates => '/root/disowned_files_before_cleanup.txt'
+    }
+    exec { 'bash -c "comm -23 <(pacman -Qq | sort) <(pacman -Qgq base | while read i; do pactree -u \$i; done | sort | uniq) > /root/packages_not_in_base_group.txt"':
+      path    => '/usr/bin',
+      creates => '/root/packages_not_in_base_group.txt'
+    }
     file { '/etc/apt':
       ensure => 'absent',
       force  => true,
@@ -21,6 +29,9 @@ class ovh_cleanup {
     file { '/etc/pacman.d/gnupg':
       ensure => 'present',
     }
+    file { '/usr/bin/growpart':
+      ensure  => 'absent',
+    }
     file { '/usr/bin/reanimate-pacman':
       ensure  => 'absent',
       require => File['/etc/pacman.d/gnupg'],
@@ -33,4 +44,32 @@ class ovh_cleanup {
       ensure  => 'absent',
       require => File['/etc/pacman.d/gnupg'],
     }
+    exec { '/usr/bin/mv /etc/lvm/lvmlocal.conf.pacnew /etc/lvm/lvmlocal.conf':
+      onlyif => '/usr/bin/test -f /etc/lvm/lvmlocal.conf.pacnew'
+    }
+    file { '/etc/resolv.conf.pacorig':
+      ensure => 'absent'
+    }
+    package { 'haveged':
+      ensure => 'absent',
+      uninstall_options => [ '-s', '-c']
+    }
+    package { 'parted':
+      ensure => 'absent',
+      uninstall_options => [ '-s', '-c']
+    }
+
+
+    file { '/etc/udev/rules.d/80-net-setup-link.rules':
+      ensure => 'absent',
+    }
+    exec { '/usr/bin/sed -i -e "s/Name=eth0/Name=en*/" /etc/systemd/network/eth0-dhcp.network':
+      subscribe   => File['/etc/udev/rules.d/80-net-setup-link.rules'],
+      refreshonly => true
+    }
+    exec { '/usr/bin/mv /etc/systemd/network/eth0-dhcp.network /etc/systemd/network/en-dhcp.network':
+      subscribe   => Exec['/usr/bin/sed -i -e "s/Name=eth0/Name=en*/" /etc/systemd/network/eth0-dhcp.network'],
+      notify      => Reboot['after_run'],
+      refreshonly => true,
+    }
 }