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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| [root@puppet production]# pwd /etc/puppetlabs/code/environments/production [root@puppet production]# cat Puppetfile mod 'puppetlabs/vcsrepo' mod 'puppetlabs/apache' mod 'puppetlabs/stdlib' mod 'puppetlabs/concat' mod 'first', :git => 'https://github.com/uphillian/uphillian-sample.git', :ref => 'master' [root@puppet production]# r10k puppetfile install [root@puppet production]# cd modules/ [root@puppet modules]# ls apache concat first stdlib vcsrepo [root@puppet modules]# cd ../manifests/ [root@puppet manifests]# ls site-2.pp site.pp [root@puppet manifests]# cat site-2.pp concat {'/etc/motd': }
package { 'epel-release': ensure => 'installed', }
package { 'figlet': ensure => 'installed', require => Package['epel-release'], }
exec {'motd.hostname': path => '/bin:/usr/bin', command => "figlet $hostname >/etc/motd.hostname", creates => '/etc/motd.hostname', require => Package['figlet'], }
exec {'motd.warning': path => '/bin:/usr/bin', command => "figlet '* WARNING *'>/etc/motd.warning", creates => '/etc/motd.warning', require => Package['figlet'], }
concat::fragment { 'hostname': target => '/etc/motd', source => '/etc/motd.hostname', order => '01', require => Exec['motd.hostname'], }
concat::fragment { 'info': target => '/etc/motd', content => "${fact('os.name')} ${fact('os.release.major')}\n", order => '05', }
$disclaimer = @(END) ----------------------------------------------------------- This system is for the use of authorized users only. Individuals using this computer system without authority, or in excess of their authority, are subject to having all of their activities on the system monitored and recorded. This information will be shared with law enforcement should any wrong doing be suspected. -----------------------------------------------------------
| END
concat::fragment { 'warning': target => '/etc/motd', source => '/etc/motd.warning', order => '10', } concat::fragment { 'disclaimer': target => '/etc/motd', content => $disclaimer, order => '20', }
# run puppet agent -t [root@puppet manifests]# cat /etc/motd _ _ __ _ _ _ __ _ __ ___| |_ | '_ \| | | | '_ \| '_ \ / _ \ __| | |_) | |_| | |_) | |_) | __/ |_ | .__/ \__,_| .__/| .__/ \___|\__| |_| |_| |_| CentOS 7 __ ___ ____ _ _ ___ _ _ ____ __/\__ \ \ / / \ | _ \| \ | |_ _| \ | |/ ___| __/\__ \ / \ \ /\ / / _ \ | |_) | \| || || \| | | _ \ / /_ _\ \ V V / ___ \| _ <| |\ || || |\ | |_| | /_ _\ \/ \_/\_/_/ \_\_| \_\_| \_|___|_| \_|\____| \/
----------------------------------------------------------- This system is for the use of authorized users only. Individuals using this computer system without authority, or in excess of their authority, are subject to having all of their activities on the system monitored and recorded. This information will be shared with law enforcement should any wrong doing be suspected. -----------------------------------------------------------
|