Remove swap

This commit is contained in:
Micke Nordin 2023-03-22 08:01:18 +01:00
parent 16bf805717
commit 4be1448dab
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257
2 changed files with 16 additions and 1 deletions

View file

@ -4,7 +4,7 @@ class sunetdrive::scriptreceiver()
sunet::system_user {'script': username => 'script', group => 'script', managehome => true, shell => '/bin/bash' } sunet::system_user {'script': username => 'script', group => 'script', managehome => true, shell => '/bin/bash' }
# These tasks correspond to a ${task}.erb.sh template # These tasks correspond to a ${task}.erb.sh template
$tasks = ['list_users', 'list_files_for_user', 'create_bucket', 'backup_db', 'purge_backups', 'maintenancemode', 'restart_sunet_service', 'start_sentinel', 'stop_sentinel', 'makeswap', 'backup_multinode_db'] $tasks = ['list_users', 'list_files_for_user', 'create_bucket', 'backup_db', 'purge_backups', 'maintenancemode', 'restart_sunet_service', 'start_sentinel', 'stop_sentinel', 'removeswap', 'backup_multinode_db']
$environment = sunetdrive::get_environment() $environment = sunetdrive::get_environment()
$config = hiera_hash($environment) $config = hiera_hash($environment)
@ -90,6 +90,12 @@ class sunetdrive::scriptreceiver()
minute => '*', minute => '*',
hour => '*', hour => '*',
} }
file { '/home/script/bin/makeswap.sh':
ensure => absent,
}
file { '/etc/sudoers.d/99-makeswap':
ensure => absent,
}
$tasks.each |String $task| { $tasks.each |String $task| {
file { "/home/script/bin/${task}.sh": file { "/home/script/bin/${task}.sh":
ensure => file, ensure => file,

View file

@ -0,0 +1,9 @@
#!/bin/bash
# Clean up old swap version
swapoff -a
cryptsetup remove cryptswap1
sed -i 's_^/dev/mapper/cryptswap1 none swap sw 0 0__' /etc/fstab
sed -i 's_/swapfile none swap sw 0 0__' /etc/fstab
sed -i 's_cryptswap1 /swapfile /dev/urandom swap,offset=1024,cipher=aes-xts-plain64__' /etc/crypttab
rm /swapfile
rm /cryptswap1