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
参考
- Ansible Documentation
http://docs.ansible.com/script_module.html