--- - name: validate ios_checkpoint_filename is defined fail: msg: "missing required var: ios_checkpoint_filename" when: ios_checkpoint_filename is undefined - name: get current files on disk cli: command: dir register: ios_dir_listing - name: remove old checkpoint file (if necessary) cli: command: "delete /force flash:/{{ ios_checkpoint_filename }}" when: ios_checkpoint_filename in ios_dir_listing.stdout # copy the current running-config to the local flash disk on the target device. # This will be used both for restoring the current config if a failure happens # as well as performing a configuration diff once the new config has been # loaded. - name: create a checkpoint of the current running-config ios_command: commands: - command: "copy running-config flash:{{ ios_checkpoint_filename }}" prompt: ["\\? "] answer: "{{ ios_checkpoint_filename }}"