If the previous task before the copy one is to install some features and
reboot then potentially the WinRM service comes back online but it reboots
one more time that isn't caught. What I would potentially do is
- name: install problematic features
win_feature:
name: ...
register: feature_install
- name: reboot after feature install
win_reboot:
when: feature_install.reboot_required
- block:
- name: copy file
win_copy:
src: files/certs/mycert_2020.pfx
dest: C:\scripts\
rescue:
- name: copy failed wait for connection to become stable
wait_for_connection:
- name: copy the file again
win_copy:
src: files/certs/mycert_2020.pfx
dest: C:\scripts\
- name: run setup script
script: files/certs/install_cert.bat
args:
creates: c:\scripts\certinstalled.txt
The block/rescue may not work as the failure happened in the connection
plugin and not the module and this usually is a fatal exception that is not
recoverable. But because win_copy is an action plugin it may work I just
can't confirm right now. If it doesn't work then you may need to look into
the logs a bit more to see why it may be rejecting your credentials or as a
precaution put a pause after the win_reboot step and then
wait_for_connection straight after to try and catch these exceptions.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a8a7682e-177f-46db-b57b-d283a1c42eda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.