Created
May 20, 2014 15:11
-
-
Save aderixon/862716503371ef473b50 to your computer and use it in GitHub Desktop.
Disable CTRL-ALT-DEL reboot sequence on Linux using Puppet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $initconf = '/etc/inittab' | |
| case $::osfamily { | |
| /(?i-mx:redhat)/: { | |
| case $::osmajor { | |
| '6': { | |
| # EL6+ has a dedicated config file | |
| file { '/etc/init/control-alt-delete.conf': | |
| ensure => 'present', | |
| source => "puppet:///modules/${module_name}/control-alt-delete.conf", | |
| owner => 'root', | |
| group => 'root', | |
| mode => '0444', | |
| } | |
| } | |
| default: { | |
| # comment out (remove and replace with identical comment) the line | |
| # for ctrlaltdel action | |
| augeas::basic-change { 'inittab-ctrlaltdel': | |
| file => $initconf, | |
| changes => [ 'ins #comment before ca', | |
| 'set #comment[following-sibling::*[1][self::ca]] "ca::ctrlaltdel:/sbin/shutdown -t3 -r now"', | |
| 'rm ca', | |
| ], | |
| onlyif => "match 'ca' size > 0", | |
| notify => Exec['inittab-ctrlaltdel'], | |
| } | |
| } | |
| } | |
| } | |
| /(?i-mx:suse)/: { | |
| augeas::basic-change { 'inittab-ctrlaltdel': | |
| file => $initconf, | |
| changes => [ 'ins #comment before ca', | |
| 'set #comment[following-sibling::*[1][self::ca]] "ca::ctrlaltdel:/sbin/shutdown -r -t 4 now"', | |
| 'rm ca', | |
| ], | |
| onlyif => "match 'ca' size > 0", | |
| notify => Exec['inittab-ctrlaltdel'], | |
| } | |
| } | |
| default: {} | |
| } | |
| exec { '/sbin/telinit q': | |
| path => ['/sbin'], | |
| alias => 'inittab-ctrlaltdel', | |
| refreshonly => true, | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment