テスト環境
役割 | ホスト名 | IP | OS |
---|---|---|---|
server | puppet-master.localhost | 172.16.0.200 | CentOS6.5 |
client | puppet-client.localhost | 172.16.0.201 | CentOS6.5 |
puppet-server
【puppet-master.localhost】puppet-serverのインストール
1.puppetリポジトリの追加
2.puppet-serverのインストール
shell
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
yum install -y puppet-server
【puppet-master.localhost】 site.pp編集
shell
vi /etc/puppet/manifests/site.pp
site.pp
# ----------------------------------------------------------
# ALLOW_VIRTUAL
# ----------------------------------------------------------
Package {
allow_virtual => true,
}
>
# ----------------------------------------------------------
# PACKAGES (yum install するもの)
# ----------------------------------------------------------
class packages {
package { "vim":
ensure => installed,
}
package { "screen":
ensure => installed,
}
}
>
# ----------------------------------------------------------
# FILES (ファイルを配布するもの)
# ----------------------------------------------------------
class files {
file { '/etc/vimrc':
owner => 'root',
group => 'root',
mode => '644',
source => "puppet:///files/vimrc",
}
file { '/etc/screenrc':
owner => 'root',
group => 'root',
mode => '644',
source => "puppet:///files/screenrc",
}
}
>
# ----------------------------------------------------------
# localhost は packages filesを行う
# ----------------------------------------------------------
node /.*\.localhost$/ {
include packages
include files
}
【puppet-master.localhost】 ファイルサーバーの設定
shell
vi /etc/puppet/fileserver.conf
fileserver.conf
[files]
path /etc/puppet/files
allow *
【puppet-master.localhost】 配布ファイルの設置
shell
cp -av /etc/vimrc /etc/puppet/files
cp -av /etc/screenrc /etc/puppet/files
【puppet-master.localhost】puppet-server の起動
shell
service puppetmaster start
puppet-client
【puppet-client.localhost】puppetのインストール
shell
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
yum install -y puppet
【puppet-client.localhost】署名リクエスト
puppet-serverに対して署名するようリクエスト
shell
puppet agent --test --server puppet-master.localhost --noop
【puppet-master.localhost】署名リクエストの署名
署名リクエストの確認
署名リクエストの署名
署名リクエスト一覧確認
shell
puppet cert --list
puppet cert sign puppet-client.localhost
puppet cert --list --all
【puppet-client.localhost】同期処理
同期テスト
同期実行
shell
puppet agent --test --verbose --server=puppet-master.localhost --noop
puppet agent --test --verbose --server=puppet-master.localhost