LoginSignup
1
1

More than 5 years have passed since last update.

Puppet Boltを使って複数台のサーバにPuppet Agentをインストールする

Last updated at Posted at 2019-02-22

Puppet Boltはタスク実行ツールです。 Puppetのタスクやマニフェストを実行することができます。

環境

  • Puppet Boltのインストール先OS : macOS Mojave 10.14.2
  • Puppet Agentのインストール先OS : CentOS 7(3.10.0-957.1.3.el7.x86_64)
  • Puppet Boltのバージョン : 1.11.0

手順

Boltをインストールします。

$ brew cask install puppetlabs/puppet/puppet-bolt

helpを確認します。

$ bolt
Usage: bolt <subcommand> <action> [options]

Available subcommands:
  bolt command run <command>       Run a command remotely
  bolt file upload <src> <dest>    Upload a local file
  bolt script run <script>         Upload a local script and run it remotely
  bolt task show                   Show list of available tasks
  bolt task show <task>            Show documentation for task
  bolt task run <task> [params]    Run a Puppet task
  bolt plan show                   Show list of available plans
  bolt plan show <plan>            Show details for plan
  bolt plan run <plan> [params]    Run a Puppet task plan
  bolt apply <manifest>            Apply Puppet manifest code
  bolt puppetfile install          Install modules from a Puppetfile into a Boltdir

実行可能なPuppetのタスクを確認します。

$ bolt task show
facts                    Gather system facts
package                  Manage and inspect the state of packages
puppet_agent::install    Install the Puppet agent package
puppet_agent::version    Get the version of the Puppet agent package installed. Returns nothing if none present.
puppet_conf              Inspect puppet agent configuration settings
reboot                   Reboots a machine
reboot::last_boot_time   Gets the last boot time of a Linux or Windows system
service                  Manage and inspect the state of services

ホストbolt-1,bolt-2,bolt-3,bolt-4にPuppetのAgentをインストールします。-uで指定するユーザでホストにsshログインできることが前提です。

$ bolt task run puppet_agent::install -n bolt-1,bolt-2,bolt-3,bolt-4 --run-as root -u hisashi_yamaguchi
--省略--
Successful on 4 nodes: bolt-1,bolt-2,bolt-3,bolt-4
Ran on 4 nodes in 31.71 seconds

Successful on 4 nodes: bolt-1,bolt-2,bolt-3,bolt-4が表示されていれば成功です。

$ bolt command run 'puppet --version' -n bolt-1,bolt-2,bolt-3,bolt-4 -u hisashi_yamaguchi
Started on bolt-1...
Started on bolt-2...
Started on bolt-3...
Started on bolt-4...
Finished on bolt-4:
  STDOUT:
    6.3.0
Finished on bolt-1:
  STDOUT:
    6.3.0
Finished on bolt-3:
  STDOUT:
    6.3.0
Finished on bolt-2:
  STDOUT:
    6.3.0
Successful on 4 nodes: bolt-1,bolt-2,bolt-3,bolt-4
Ran on 4 nodes in 3.70 seconds
1
1
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
1