aboutsummaryrefslogtreecommitdiff
path: root/modules/ovh_cleanup/manifests/init.pp
blob: fc1b84b308696124ebef0d3e1524c4b8c3fcbbf3 (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
71
72
73
74
75
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,
    }
    file { '/etc/default/keyboard':
      ensure => 'absent',
    }
    file { '/etc/default/locale':
      ensure => 'absent',
    }
    file { '/etc/timezone':
      ensure => 'absent',
    }
    file { '/etc/pacman.d/mirrorlist.pacnew':
      ensure => 'absent',
    }
    exec { '/usr/bin/reanimate-pacman':
      creates => '/etc/pacman.d/gnupg',
    }
    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'],
    }
    file { '/etc/systemd/system/pacman-reanimation.service':
      ensure  => 'absent',
      require => File['/etc/pacman.d/gnupg'],
    }
    file { '/etc/systemd/system/multi-user.target.wants/pacman-reanimation.service':
      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,
    }
}