strategy プラグイン
strategy プラグインは、タスクおよびホストスケジューリングを処理し、プレイ実行のフローを制御します。strategy プラグインの使用方法や、実行の順番を制御する他の方法は、「Playbook の実行の制御: strategy など」を参照してください。
strategy プラグインの有効化
Ansible に同梱されているすべての strategy プラグインは、デフォルトで有効になっています。カスタムの strategy プラグインを有効にするには、ansible.cfg で設定したルックアップディレクトリーソースの 1 つにそれを置きます。
strategy プラグインの使用
プレイで使用できる strategy プラグインは 1 つだけですが、Playbook または ansible の実行でプレイごとに異なるプラグインを使用できます。デフォルトでは Ansible は linear プラグインを使用します。環境変数を使用して、Ansible configuration でこのデフォルトを変更できます。
export ANSIBLE_STRATEGY=free
または ansible.cfg ファイルで、以下を行います。
[defaults]
strategy=linear
プレイの strategy keyword を使用して、プレイの strategy プラグインを指定することもできます。
- hosts: all
strategy: debug
tasks:
- copy: src=myhosts dest=/etc/hosts
notify: restart_tomcat
- package: name=tomcat state=present
handlers:
- name: restart_tomcat
service: name=tomcat state=restarted
プラグイン一覧
ansible-doc -t strategy -l を使用して、利用可能なプラグインの一覧を表示します。ansible-doc -t strategy <plugin name> を使用して、プラグイン固有のドキュメントと例を参照してください。
参考
- Ansible Playbook
Playbook の概要
- inventory プラグイン
inventory プラグイン
- callback プラグイン
callback プラグイン
- filter プラグイン
filter プラグイン
- test プラグイン
test プラグイン
- lookup プラグイン
lookup プラグイン
- User Mailing List
ご質問はございますか。Google Group をご覧ください。
- リアルタイムチャット
Ansible チャットチャンネルへの参加方法