【问题标题】:Ansible is skipping the debug lineAnsible 正在跳过调试行
【发布时间】:2018-07-17 13:14:26
【问题描述】:

我在一个角色中有这个任务,它下面有一个调试行:

- name: Restore bootstrap DB
  command: "mongorestore -v --host localhost:{{ mongodb_net.port }} -d {{ item.dbname }} --dir {{ item.clone_dir }}"
  register: restore_result
  with_items:
    - { dbname: "{{ mongodb_db1_dbname }}", clone_dir: "/var/tmp/db_bootstrap/DB1_CLONE" }
    - { dbname: "{{ mongodb_db2_dbname }}", clone_dir: "/var/tmp/db_bootstrap/DB2_CLONE" }

- debug: var=restore_result verbosity=2

但它正在跳过调试任务。

TASK [mongodb : Restore bootstrap DB] ***************************************************
changed: [xx.xx.xx.167] => (item={u'dbname': u'DB1', u'clone_dir': u'/var/tmp/db_bootstrap/DB1'})
changed: [xx.xx.xx.167] => (item={u'dbname': u'DB2', u'clone_dir': u'/var/tmp/db_bootstrap/DB2'})

TASK [mongodb : debug] ******************************************************************
skipping: [xx.xx.xx.167]

当我启用详细模式时,-vv,它会显示注册变量的内容。

我使用的是 Ansible 版本 2.4.3

【问题讨论】:

    标签: ansible ansible-2.x


    【解决方案1】:

    2.4.3中缺少一个没有显示跳过原因的功能,这是在2.6.1中添加的;将我的版本升级到 2.6.1 并看到原因:

    TASK [mongodb : debug] ********************************************************************************
    skipping: [xx.xx.xx.167] => {"skipped_reason": "Verbosity threshold not met."}
    

    所以我从任务中删除了verbosity=2,它现在按预期工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-04
      • 1970-01-01
      • 2013-06-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-10
      • 1970-01-01
      • 2014-01-30
      相关资源
      最近更新 更多