在我的 ansible 配置文件中,我添加了一些非默认值:
log_path=./ansible_log.txt
# (boolean) Normally ``ansible-playbook`` will print a header for each task that is run. These headers will contain the name: field from the task if you specified one. If you didn't then ``ansible-playbook`` uses the task's action to help you tell which task is presently running. Sometimes you run many of the same action and so you want more information about the task to differentiate it from others of the same action. If you set this variable to True in the config then ``ansible-playbook`` will also include the task's arguments in the header.
# This setting defaults to False because there is a chance that you have sensitive values in your parameters and you do not want those to be printed.
# If you set this to True you should be sure that you have secured your environment's stdout (no one can shoulder surf your screen and you aren't saving stdout to an insecure file) or made sure that all of your playbooks explicitly added the ``no_log: True`` parameter to tasks which have sensitive values See How do I keep secret data in my playbook? for more information.
display_args_to_stdout=True
# (boolean) Set this to "False" if you want to avoid host key checking by the underlying tools Ansible uses to connect to the host
host_key_checking=False
# (string) Set the main callback used to display Ansible output. You can only have one at a time.
# You can have many other callbacks, but just one can be in charge of stdout.
# See :ref:`callback_plugins` for a list of available options.
;stdout_callback=default
callbacks_enabled=ansible.posix.profile_tasks, ansible.posix.timer
当我ansible --version
在与执行 ansible playbook 的目录相同的目录中运行时,我得到:
ansible [核心 2.15.3]
配置文件 = /home/my_name/repos/some_repo/dev/ansible.cfg
当我使用cat /home/my_name/repos/some_repo/dev/ansible.cfg
查看配置文件的内容时,我可以验证配置是否具有上述内容。
因此,ansible--version
报告预期的 ansible.cfg 文件,该文件包含预期的设置,但这些设置似乎被忽略,我没有看到回调值的额外输出,也没有生成日志记录。
如何确保 ansible.cfg 值不被忽略?