2016-10-28 20:50:29 +02:00
|
|
|
---
|
|
|
|
- hosts: iosxr
|
|
|
|
gather_facts: no
|
2017-02-27 15:37:06 +01:00
|
|
|
connection: local
|
2016-10-28 20:50:29 +02:00
|
|
|
|
|
|
|
vars:
|
|
|
|
limit_to: "*"
|
|
|
|
debug: false
|
|
|
|
|
2017-08-19 23:00:51 +02:00
|
|
|
# Run the tests within blocks allows the next module to be tested if the previous one fails.
|
2017-07-04 19:18:02 +02:00
|
|
|
# This is done to allow https://github.com/ansible/dci-partner-ansible/ to run the full set of tests.
|
|
|
|
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- set_fact:
|
|
|
|
test_failed: false
|
2017-07-20 04:17:07 +02:00
|
|
|
failed_modules: []
|
2017-07-04 19:18:02 +02:00
|
|
|
- block:
|
|
|
|
- include_role:
|
|
|
|
name: iosxr_command
|
|
|
|
when: "limit_to in ['*', 'iosxr_command']"
|
|
|
|
rescue:
|
2017-07-20 04:17:07 +02:00
|
|
|
- set_fact:
|
|
|
|
failed_modules: "{{ failed_modules }} + [ 'iosxr_command' ]"
|
|
|
|
test_failed: true
|
2017-07-04 19:18:02 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- include_role:
|
|
|
|
name: iosxr_config
|
|
|
|
when: "limit_to in ['*', 'iosxr_config']"
|
|
|
|
rescue:
|
2017-07-20 04:17:07 +02:00
|
|
|
- set_fact:
|
|
|
|
failed_modules: "{{ failed_modules }} + [ 'iosxr_config' ]"
|
|
|
|
test_failed: true
|
2017-07-04 19:18:02 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- include_role:
|
|
|
|
name: iosxr_facts
|
|
|
|
when: "limit_to in ['*', 'iosxr_facts']"
|
|
|
|
rescue:
|
2017-07-20 04:17:07 +02:00
|
|
|
- set_fact:
|
|
|
|
failed_modules: "{{ failed_modules }} + [ 'iosxr_facts' ]"
|
|
|
|
test_failed: true
|
2017-07-04 19:18:02 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- include_role:
|
|
|
|
name: iosxr_system
|
|
|
|
when: "limit_to in ['*', 'iosxr_system']"
|
|
|
|
rescue:
|
2017-07-20 04:17:07 +02:00
|
|
|
- set_fact:
|
|
|
|
test_failed: true
|
|
|
|
failed_modules: "{{ failed_modules }} + [ 'iosxr_system' ]"
|
2017-07-04 19:18:02 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- include_role:
|
|
|
|
name: iosxr_user
|
|
|
|
when: "limit_to in ['*', 'iosxr_user']"
|
|
|
|
rescue:
|
2017-07-20 04:17:07 +02:00
|
|
|
- set_fact:
|
|
|
|
failed_modules: "{{ failed_modules }} + [ 'iosxr_user' ]"
|
|
|
|
test_failed: true
|
2017-07-04 19:18:02 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- include_role:
|
|
|
|
name: iosxr_banner
|
|
|
|
when: "limit_to in ['*', 'iosxr_banner']"
|
|
|
|
rescue:
|
2017-07-20 04:17:07 +02:00
|
|
|
- set_fact:
|
|
|
|
failed_modules: "{{ failed_modules }} + [ 'iosxr_banner' ]"
|
|
|
|
test_failed: true
|
2017-07-04 19:18:02 +02:00
|
|
|
|
2017-07-17 13:50:22 +02:00
|
|
|
- block:
|
|
|
|
- include_role:
|
|
|
|
name: iosxr_logging
|
|
|
|
when: "limit_to in ['*', 'iosxr_logging']"
|
|
|
|
rescue:
|
2017-07-20 04:17:07 +02:00
|
|
|
- set_fact:
|
|
|
|
failed_modules: "{{ failed_modules }} + [ 'iosxr_logging' ]"
|
|
|
|
test_failed: true
|
2017-07-17 13:50:22 +02:00
|
|
|
|
2017-08-01 16:49:54 +02:00
|
|
|
- block:
|
|
|
|
- include_role:
|
|
|
|
name: iosxr_interface
|
|
|
|
when: "limit_to in ['*', 'iosxr_interface']"
|
|
|
|
rescue:
|
|
|
|
- set_fact:
|
|
|
|
failed_modules: "{{ failed_modules }} + [ 'iosxr_interface' ]"
|
|
|
|
test_failed: true
|
|
|
|
|
2017-07-04 19:18:02 +02:00
|
|
|
###########
|
2017-07-20 04:17:07 +02:00
|
|
|
- debug: var=failed_modules
|
|
|
|
when: test_failed
|
|
|
|
|
2017-07-04 19:18:02 +02:00
|
|
|
- name: Has any previous test failed?
|
|
|
|
fail:
|
|
|
|
msg: "One or more tests failed, check log for details"
|
2017-07-17 13:50:22 +02:00
|
|
|
when: test_failed
|