From 3f5cf2aad4f07866abe016f927f7450538704f91 Mon Sep 17 00:00:00 2001 From: Chris Smolen Date: Fri, 17 Aug 2018 11:30:37 -0700 Subject: [PATCH] add example using the "when" keyword (#41038) * add example using the "when" keyword add example using the "when" keyword comparing group_var variable to returned value from ios_facts +label: docsite_pr +label: issue #311 * Update ios_config.py * Update ios_config.py --- lib/ansible/modules/network/ios/ios_config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/modules/network/ios/ios_config.py b/lib/ansible/modules/network/ios/ios_config.py index 7f6865ab748..33535648e00 100644 --- a/lib/ansible/modules/network/ios/ios_config.py +++ b/lib/ansible/modules/network/ios/ios_config.py @@ -272,6 +272,16 @@ EXAMPLES = """ - shutdown # parents: int gig1/0/11 parents: interface GigabitEthernet1/0/11 + +# Set boot image based on comparison to a group_var (version) and the version +# that is returned from the `ios_facts` module +- name: SETTING BOOT IMAGE + ios_config: + lines: + - no boot system + - boot system flash bootflash:{{new_image}} + host: "{{ inventory_hostname }}" + when: ansible_net_version != version """ RETURN = """