ansibleのディレクティブ
ansible
block (Ansible)
stat
https://docs.ansible.com/ansible/2.9/modules/stat_module.html
register
Ansibleではregisterというモジュールを使用することで、結果を変数の中に一時的に保管しておく事が出来ます。
https://www.scsk.jp/product/oss/tec_guide/ansible/1_ansible3_1.html
これをansible.builtin.debugで表示してデバッグする
whenと一緒に使うと便利
code:yaml
# statの結果を変数に入れてdebugでprintする
- name: apacheがインストールされているか
stat:
path: /usr/sbin/httpd
register: exists_httpd
# ここに直接 debug: var= とすることはできない
- name: debug
debug:
var: exists_httpd
handler (Ansible)
ansible.builtin系は全て省略できるっぽい