Shell 如何在ansible中向正在运行的命令添加密码

Shell 如何在ansible中向正在运行的命令添加密码,shell,ansible,wso2,wso2-am,Shell,Ansible,Wso2,Wso2 Am,我的任务是运行密码加密加密工具 tags: encrypting command: sh {{ansible_env.HOME}}/wso2/apim/{{item}}/wso2am-2.6.0/bin/ciphertool.sh -Dconfigure with_sequence: start=1 end={{ no_of_nodes }} 此任务需要密码。但是它失败了,因为没有提供提示密码来发送密码。如何解决此问题?使用模块。引用如何为命令提供密码 - name: Case

我的任务是运行密码加密加密工具

  tags: encrypting
  command: sh {{ansible_env.HOME}}/wso2/apim/{{item}}/wso2am-2.6.0/bin/ciphertool.sh -Dconfigure 
  with_sequence: start=1  end={{ no_of_nodes }}
此任务需要密码。但是它失败了,因为没有提供提示密码来发送密码。如何解决此问题?

使用模块。引用如何为
命令提供密码

- name: Case insensitive password string match
  expect:
    command: passwd username
    responses:
      (?i)password: "MySekretPa$$word"
  # you don't want to show passwords in your logs
  no_log: true
在您的情况下,任务可能与此任务类似。根据您的需要设置密码提示

- expect:
    command: sh {{ansible_env.HOME}}/wso2/apim/{{item}}/wso2am-2.6.0/bin/ciphertool.sh -Dconfigure 
    responses:
      (?i)password: "MySekretPassword"
  loop: "{{ range(1, no_of_nodes)|list }}"
  no_log: true
  tags: encrypting