talvez eu não entenda corretamente:
Eu gostaria de definir algumas tarefas por meio do fantoche que são aplicadas em todos os hosts conectados.
Este é o meu site.pp:
node default {
## Add default user ##
user { 'test':
ensure => present,
managehome => true,
password => '$6$XYZ',
}
## Create sudoers ##
class { 'sudo': }
sudo::conf {
'test':
priority => 60,
content => "test ALL=(ALL) ALL"
}
## Install bareos client ##
class {
'bareos':
manage_client => 'true',
}
}
## Create test-file ##
node 'pp-test' {
file { '/tmp/puppet-test':
ensure => present,
mode => 0644,
content => "Only test-servers get this file.\n",
}
include base-software
class {
'ssh':
server_options => {
'Port' => '2211',
'Protocol' => '2',
'HostKey' => '/etc/ssh/ssh_host_rsa_key',
'HostKey' => '/etc/ssh/ssh_host_dsa_key',
'HostKey' => '/etc/ssh/ssh_host_ecdsa_key',
'UsePrivilegeSeparation' => 'yes',
'KeyRegenerationInterval' => '3600',
'ServerKeyBits' => '1024',
'SyslogFacility' => 'AUTH',
'LogLevel' => 'INFO',
'LoginGraceTime' => '120',
'PermitRootLogin' => 'no',
'StrictModes' => 'yes',
'RSAAuthentication' => 'yes',
'PubkeyAuthentication' => 'yes',
'IgnoreRhosts' => 'yes',
'RhostsRSAAuthentication' => 'no',
'HostbasedAuthentication' => 'no',
'PermitEmptyPasswords' => 'no',
'ChallengeResponseAuthentication'=> 'no',
'PasswordAuthentication' => 'yes',
'AllowUsers' => 'test',
}
}
}
Infelizmente, o usuário "test" não está sendo configurado no nó de teste pp-test
Depois de ler seus comentários, criei outro layout:
profile/
'-- manifests
|-- backup
| |-- client.pp
| '-- server.pp
|-- backup.pp
'-- base.pp
role/
'-- manifests
|-- backup.pp
'-- init.pp
profile / manifests / base.pp contém:
class profile::base {
## Add MOTD ##
class {
'motd':
template => '/etc/puppet/modules/motd/templates/motd.erb',
}
## Add default user ##
user { 'test':
ensure => 'present',
managehome => 'true',
password => '$6$XYZ',
}
## Create sudoers ##
class { 'sudo': }
sudo::conf {
'test':
priority => '60',
content => "test ALL=(ALL) ALL"
}
## Install base-software
include base-software
## Configuration of OpenSSH-Server ##
class {
'ssh':
server_options => {
'Port' => '2211',
'Protocol' => '2',
'HostKey' => '/etc/ssh/ssh_host_rsa_key',
'HostKey' => '/etc/ssh/ssh_host_dsa_key',
'HostKey' => '/etc/ssh/ssh_host_ecdsa_key',
'UsePrivilegeSeparation' => 'yes',
'KeyRegenerationInterval' => '3600',
'ServerKeyBits' => '1024',
'SyslogFacility' => 'AUTH',
'LogLevel' => 'INFO',
'LoginGraceTime' => '120',
'PermitRootLogin' => 'no',
'StrictModes' => 'yes',
'RSAAuthentication' => 'yes',
'PubkeyAuthentication' => 'yes',
'IgnoreRhosts' => 'yes',
'RhostsRSAAuthentication' => 'no',
'HostbasedAuthentication' => 'no',
'PermitEmptyPasswords' => 'no',
'ChallengeResponseAuthentication'=> 'no',
'PasswordAuthentication' => 'yes',
'AllowUsers' => 'test',
}
}
}
Agora criei meu site.pp da seguinte forma:
node default {
include role::backup::client ##add bacula to all servers
}
node 'pp-test' {
file { '/etc/test.txt':
ensure => present,
mode => 0644,
content => "Test\n",
}
}
node 'backupserver' {
include role::backup::server
}
Bem, o problema persiste: assim que eu definir pp-test
, os pacotes padrão não serão instalados.