首页 > 解决方案 > 一个密码失败时的ansible库存尝试不同

问题描述

我还没有找到解决方案,我们有 100 台服务器,我不知道正确的密码。我有 3 个密码,但只有一个是正确的。如果无法登录,我怎么能说 ansible 然后尝试另一个密码?

inventory.yaml 文件,这不起作用。

all:
  #hosts:
    #192.168.100.102:
  children:
    my_servers:
      hosts:
        192.168.100.101:
          ansible_password : "{{ item }}"
          with_items:
            - psw1
            - psw2
            - psw3
        192.168.100.102:

...

ansible -i inventory.yaml my_servers -a "free -h" -u test

192.168.100.101 | 失败 | rc=-1 >> 字段“密码”的值无效,其中包括未定义的变量。错误是:“项目”未定义

标签: ansible-inventory

解决方案


推荐阅读