0
1

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 5 years have passed since last update.

Puppet Boltを動かす

Posted at

参考

インストール

yum install -y \
  "https://yum.puppet.com/puppet-tools-release-el-8.noarch.rpm"

yum install -y puppet-bolt

boltの使い方

コマンド一覧
$ bolt
Usage: bolt <subcommand> <action>

Available subcommands:
  bolt command run <command>       Run a command remotely
  bolt file upload <src> <dest>    Upload a local file or directory
  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 convert <plan_path>    Convert a YAML plan to a Puppet plan
  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
  bolt puppetfile show-modules     List modules available to Bolt
  bolt secret createkeys           Create new encryption keys
  bolt secret encrypt <plaintext>  Encrypt a value
  bolt secret decrypt <encrypted>  Decrypt a value
  bolt inventory show              Show the list of targets an action would run on
  bolt group show                  Show the list of groups in the inventory
  bolt project init                Create a new Bolt project

Run `bolt <subcommand> --help` to view specific examples.

Available options are:

Global:
    -h, --help                       Display help
        --version                    Display the version
        --debug                      Display debug logging

bolt task

task一覧
$ bolt task show
aws_inventory::resolve_reference     Generate targets from AWS EC2 instances
azure_inventory::resolve_reference   Generate targets from Azure VMs
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
terraform::resolve_reference         Generate targets from Terraform Statefile
vault::resolve_reference             Set config values by accessing secrets in Hashicorp Vault

MODULEPATH:
/root/.puppetlabs/bolt/modules:/root/.puppetlabs/bolt/site-modules:/root/.puppetlabs/bolt/site

Use `bolt task show <task-name>` to view details and parameters for a specific task.
  • /root/.puppetlabs/bolt/site-modules/ にtaskを置けば良いことがわかる。
mkdir -p /root/.puppetlabs/bolt/site-modules/exercise5/tasks/
/root/.puppetlabs/bolt/site-modules/exercise5/tasks/init.sh
# !/bin/sh

echo $(hostname) received the message: $PT_message
実行
# $PT_message には hello が入る。
bolt task run exercise5 message=hello --nodes localhost

bolt script

bolt script run exercise5/tasks/init.sh --nodes localhost

メモ: docker でも実行ができる

# コンテナ内の /etc/os-release が表示される例
docker run puppet/puppet-bolt \
 command run 'cat /etc/os-release' \
 -t localhost
0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?