Senan T
Senan T

Reputation: 33

ansible expect module does not create the file with creates option

I have the below task

- 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

when I run the task the password is set but the file is not created. I have checked multiple issue with expect module but I don't see any that touch on the creates option. I tried different servers and got the same thing. without the creates option the password is set as well. Any help in troubleshooting why the file isn't being created will be appreciated.

Upvotes: 0

Views: 67

Answers (1)

SPC0nline
SPC0nline

Reputation: 39

Try this one instead

  • 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 }}" changed_when: true notify: grub2-mkconfig no_log: true tags:
    • fix

Upvotes: -2

Related Questions