April 2020
Intermediate to advanced
482 pages
15h 16m
English
We can use check mode as a switch to run or skip tasks. So, in some cases when we are running in check mode, we would not like to connect to the device and push any configuration on the device, since nothing will be changed. Using check mode, we can build our playbooks to skip these tasks, as shown in the following code block:
- name: Configure ACL on IOS-XR hosts: all serial: 1 tags: deploy tasks: - name: Backup Config iosxr_config: backup: when: not ansible_check_mode - name: Deploy ACLs iosxr_config: src: acl_conf.cfg match: line when: not ansible_check_mode
In our tasks, we added the when directive, and we are checking the value for the ansible_check_mode parameter. This parameter is set to true when we run our playbook ...
Read now
Unlock full access