Ansible で DEFAULT_SUDO_FLAGS から DEFAULT_BECOME_FLAGS に 変更


SUDO_FLAG は 非推奨の Warning が 出た場合

Warning
[DEPRECATION WARNING]: DEFAULT_SUDO_FLAGS option, In favor of Ansible Become, which is a generic framework. See become_flags. , use become instead.
This feature will be removed in version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

/etc/ansible/ansible.cfg を 変更してください。

ansible.cfg
*** sudo_flgas を コメントアウト ***

# What flags to pass to sudo
# WARNING: leaving out the defaults might create unexpected behaviours
#sudo_flags = -H -S -n

*** become_flags を 追記(もしくはコメント解除) ***

[privilege_escalation]
・・・
become_flags = -H -S -n

Warning が でないことを確認

確認コマンド
# ansible-config dump --only-changed
・・・
DEFAULT_BECOME_FLAGS(/etc/ansible/ansible.cfg) = -H -S -n
・・・