|
17 | 17 | # NTP servers are defined and are valid IPv4 addresses. |
18 | 18 | # This task uses the "assert" module as a way of integrating |
19 | 19 | # testing within a playbook. |
20 | | - - name: "TASK 1: Validate NTP server IP addresses" |
| 20 | + - name: "TASK 0: Validate NTP server IP addresses" |
21 | 21 | assert: |
22 | 22 | that: |
23 | 23 | - "ntp_server1 is defined" |
|
27 | 27 | msg: "Malformed input; please check ntp_server values" |
28 | 28 |
|
29 | 29 | # This is the second task. It logs into the Cisco IOS or |
30 | | - # IOS-XE device using the "ios_config" module. The commands |
| 30 | + # IOS-XE device using the "ios_config" module. The 'lines' |
31 | 31 | # specified within that module are passed to the router, and |
32 | 32 | # the NTP server values are substituted using {{ }} syntax. |
33 | 33 | # The previous task verified that these servers were valid, |
|
36 | 36 | # feedback from the module, which provides us a list of which |
37 | 37 | # commands needed to be added (between 0 and 4 in this case), |
38 | 38 | # whether there were any failures, and more. |
39 | | - - name: "TASK 2: Apply NTP updates" |
| 39 | + - name: "TASK 1: Apply NTP updates" |
40 | 40 | ios_config: |
41 | | - commands: |
| 41 | + lines: |
42 | 42 | - "ntp authenticate" |
43 | 43 | - "ntp logging" |
44 | 44 | - "ntp server {{ ntp_server1 }}" |
|
54 | 54 | # be false when the registered variable from the previous task |
55 | 55 | # does not define the "updates" subfield, which indicates no |
56 | 56 | # changes were needed. |
57 | | - - name: "TASK 3: Print changes if NTP config changed" |
| 57 | + - name: "TASK 2: Print changes if NTP config changed" |
58 | 58 | debug: |
59 | 59 | var: "ntp_updates.updates" |
60 | 60 | when: "ntp_updates.updates is defined" |
|
0 commit comments