1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Puppet Server を dockerで動かして、Ubuntu 20.04 からagent接続

Last updated at Posted at 2019-11-08

参考

起動

puppetmaster
# https://hub.docker.com/r/puppet/puppetserver

mkdir -p code

docker run \
 -it -d \
 --restart=always \
 --name puppet \
 --hostname puppet \
 -p 8140:8140 \
 -v $(pwd)/code:/etc/puppetlabs/code/ \
 puppet/puppetserver:6.12.0
  • 他のバージョンを動かしたい場合は、6.12.0の箇所を2.7.2にするだけでよい。
manifest格納場所の作成
mkdir -p ./code/environments/production/manifests/
code/environments/production/manifests/site.pp
node default {
  file {'/tmp/example-ip':
    ensure  => present,
    mode    => '0644',
    content => "Here is my Public IP Address: ${ipaddress_eth0}.\n",
  }
}

実行

  • docker exec -it コンテナID /bin/bash でコンテナに入って以下実施
# dry-run
puppet agent --test --noop

# 実行
puppet agent --test
# 念のため、signed一覧
puppetserver ca list --all

Ubuntu 20.04 に agent 追加

wget https://apt.puppetlabs.com/puppet6-release-focal.deb
dpkg -i puppet6-release-focal.deb

apt update

apt install -y puppet-agent
# /opt/puppetlabs にインストールされる。

puppetサーバーの名前解決ができるようにしておく。(docker --hostname で指定したホスト名)

/etc/hosts
# 127.0.0.1 puppet
192.168.0.6 puppet
# puppetserverに接続
#   proxy接続中は接続が失敗する。403 "Access violation"

export PATH=$PATH:/opt/puppetlabs/bin

puppet agent --server puppet -t --noop --verbose
念の為、puppetサーバーで確認
# 自動でsignされている

puppetserver ca list --all
実行
export PATH=$PATH:/opt/puppetlabs/bin

# dry-run
puppet agent --server puppet -t --noop

# 実行
puppet agent --server puppet -t
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?