LoginSignup
7
8

More than 5 years have passed since last update.

Ansible ~scriptモジュール~

Posted at

Ansible Documentationのscriptモジュールのメモです。

Ansible Documentation

概要

  • scriptモジュールは、ローカルのシェルスクリプトをリモート上で実行する

オプション

頻度 パラメータ 必須 デフォルト値 選択肢 説明
creates no - - 指定したファイル名が既に存在する場合、シェルスクリプトを実行しない。
free_form yes - - 実行するシェルスクリプトのローカルパスの指定。free_formというオプション名はつけず、パスを書き始めれば良い。
removes no - - 指定したファイル名が存在しない場合、シェルスクリプトを実行しない。

example.yml
# Example from Ansible Playbooks
- script: /some/local/script.sh --some-arguments 1234

# Run a script that creates a file, but only if the file is not yet created
- script: /some/local/create_file.sh --some-arguments 1234 creates=/the/created/file.txt

# Run a script that removes a file, but only if the file is not yet removed
- script: /some/local/remove_file.sh --some-arguments 1234 removes=/the/removed/file.txt

参考

7
8
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
7
8