ansible Expect 模块不会使用创建选项创建文件

问题描述 投票:0回答:1

我有以下任务

- name: "PATCH| 1.5.2 | Ensure bootloader password is set"
  ansible.builtin.expect:
    command: grub2-setpassword
    responses:
      Enter password: "{{ grub_password }}"
      Confirm password: "{{ grub_password }}"
    creates: /boot/grub2/user.cfg
  notify: grub2-mkconfig
  no_log: true
  tags: 
    - fix

当我运行任务时,密码已设置,但未创建文件。我已经检查了 Expect 模块的多个问题,但没有看到任何涉及

creates
选项的问题。我尝试了不同的服务器并得到了相同的结果。如果没有
creates
选项,密码也会被设置。任何有关解决未创建文件原因的帮助将不胜感激。

ansible expect
1个回答
0
投票

试试这个吧

  • 名称:“补丁| 1.5.2 | 确保设置引导加载程序密码” ansible.builtin.expect: 命令:grub2-setpassword 回应: 输入密码:“{{ grub_password }}” 确认密码:“{{ grub_password }}” 更改时间:true 通知:grub2-mkconfig 无日志:真 标签:
    • 修复
© www.soinside.com 2019 - 2024. All rights reserved.