微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Ansible - 如何设置运行的默认值VERBOSE Level 或 VERBOSITY,即使用一些配置设置 ansible.cfg etc

如何解决Ansible - 如何设置运行的默认值VERBOSE Level 或 VERBOSITY,即使用一些配置设置 ansible.cfg etc

ansible 2.8.3
  config file = /etc/ansible/ansible.cfg

当我运行:ansible-playbook -i hosts playbooks/installer.yml -K 时,它为剧本中的每个任务操作呈现非常简单的干净输出

例如:

TASK [installer : Installing docker sdk using pip] ***********************************************************************************************************************************************************
ok: [ansiblenode01.my.server.com]

我希望输出比上面显示的一行更详细。为此,当我传递 -v Ansible 命令行详细选项时,它给了我以下输出

ansible-playbook -i hosts playbooks/installer.yml -K -v

例如:

TASK [installer : Installing docker sdk using pip] ***********************************************************************************************************************************************************
ok: [ansiblenode01.my.server.com] => {
    "changed": false,"cmd": [
        "/bin/pip2","install","--no-index","--find-links=/tmp/dockerSDKforPython/","docker"
    ],"name": [
        "docker"
    ],"requirements": null,"state": "present","version": null,"virtualenv": null
}

STDOUT:

Ignoring indexes: https://pypi.python.org/simple
Requirement already satisfied (use --upgrade to upgrade): docker in /usr/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker)
Requirement already satisfied (use --upgrade to upgrade): ipaddress>=1.0.16; python_version < "3.3" in /usr/lib/python2.7/site-packages (from docker)
Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/lib/python2.7/site-packages (from docker)
Requirement already satisfied (use --upgrade to upgrade): requests!=2.18.0,>=2.14.2 in /usr/lib/python2.7/site-packages (from docker)
Requirement already satisfied (use --upgrade to upgrade): websocket-client>=0.32.0 in /usr/lib/python2.7/site-packages (from docker)
Requirement already satisfied (use --upgrade to upgrade): chardet<4,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests!=2.18.0,>=2.14.2->docker)
Requirement already satisfied (use --upgrade to upgrade): urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests!=2.18.0,>=2.14.2->docker)
Requirement already satisfied (use --upgrade to upgrade): idna<3,>=2.5 in /usr/lib/python2.7/site-packages (from requests!=2.18.0,>=2.14.2->docker)
Requirement already satisfied (use --upgrade to upgrade): certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests!=2.18.0,>=2.14.2->docker)

我的问题: 如何在某些 Ansible 配置文件中设置此命令行 VERBOSE 级别的单个 -v 选项(或 -vv-vvv)?

我检查了 /etc/ansible/ansible.cfg 和一些帖子/博客,但找不到太多相关信息。我想知道是否应该有一些用户可以设置详细级别的设置,而不是键入 -v,-vv or -vvv etc(在命令行 - 每次)。

PS:我知道如何创建别名并希望避免在我的剧本的每个任务中都有 register: variable用户可以在其中使用 ansible.builtin.debug

谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。