2017-07-25 11:33:54 +00:00
|
|
|
---
|
2018-01-15 07:46:41 +00:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_logging basic test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
|
|
|
|
2017-07-25 11:33:54 +00:00
|
|
|
- name: Set up console logging
|
2018-05-11 07:43:49 +00:00
|
|
|
nxos_logging: &clog
|
2017-07-25 11:33:54 +00:00
|
|
|
dest: console
|
|
|
|
dest_level: 0
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"logging console 0" in result.commands'
|
|
|
|
|
|
|
|
- name: Set up console logging again (idempotent)
|
2018-05-11 07:43:49 +00:00
|
|
|
nxos_logging: *clog
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
2018-05-11 07:43:49 +00:00
|
|
|
- assert: &false
|
2017-07-25 11:33:54 +00:00
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
2018-05-11 07:43:49 +00:00
|
|
|
- name: Logfile logging with level
|
|
|
|
nxos_logging: &llog
|
|
|
|
dest: logfile
|
|
|
|
name: test
|
|
|
|
dest_level: 1
|
|
|
|
state: present
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2018-05-11 07:43:49 +00:00
|
|
|
- '"logging logfile test 1" in result.commands'
|
2017-07-25 11:33:54 +00:00
|
|
|
|
2018-05-11 07:43:49 +00:00
|
|
|
- name: Logfile logging with level (idempotent)
|
|
|
|
nxos_logging: *llog
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure module with level
|
|
|
|
nxos_logging: &molog
|
|
|
|
dest: module
|
|
|
|
dest_level: 2
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2018-05-11 07:43:49 +00:00
|
|
|
- 'result.changed == true'
|
|
|
|
- '"logging module 2" in result.commands'
|
2017-07-25 11:33:54 +00:00
|
|
|
|
2018-05-11 07:43:49 +00:00
|
|
|
- name: Configure module with level (idempotent)
|
|
|
|
nxos_logging: *molog
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: Configure monitor with level
|
|
|
|
nxos_logging: &mlog
|
|
|
|
dest: monitor
|
|
|
|
dest_level: 3
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2018-05-11 07:43:49 +00:00
|
|
|
- '"logging monitor 3" in result.commands'
|
|
|
|
|
|
|
|
- name: Configure monitor with level (idempotent)
|
|
|
|
nxos_logging: *mlog
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
2017-07-25 11:33:54 +00:00
|
|
|
|
|
|
|
- name: Configure facility with level
|
2018-05-11 07:43:49 +00:00
|
|
|
nxos_logging: &flog
|
2017-07-25 11:33:54 +00:00
|
|
|
facility: daemon
|
2018-05-11 07:43:49 +00:00
|
|
|
facility_level: 4
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2018-05-11 07:43:49 +00:00
|
|
|
- '"logging level daemon 4" in result.commands'
|
|
|
|
|
|
|
|
- name: Configure facility with level (idempotent)
|
|
|
|
nxos_logging: *flog
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
2017-07-25 11:33:54 +00:00
|
|
|
|
|
|
|
- name: remove logging as collection tearDown
|
2018-05-11 07:43:49 +00:00
|
|
|
nxos_logging: &agg
|
2017-07-25 11:33:54 +00:00
|
|
|
aggregate:
|
2018-05-11 07:43:49 +00:00
|
|
|
- { dest: console, dest_level: 0 }
|
|
|
|
- { dest: module, dest_level: 2 }
|
|
|
|
- { dest: monitor, dest_level: 3 }
|
|
|
|
- { dest: logfile, dest_level: 1, name: test }
|
|
|
|
- { facility: daemon, facility_level: 4 }
|
|
|
|
state: absent
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"no logging logfile" in result.commands'
|
|
|
|
- '"no logging level daemon" in result.commands'
|
2018-05-11 07:43:49 +00:00
|
|
|
- '"no logging monitor" in result.commands'
|
|
|
|
- '"no logging module" in result.commands'
|
|
|
|
|
|
|
|
- name: remove aggregate logging (idempotent)
|
|
|
|
nxos_logging: *agg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
2018-01-15 07:46:41 +00:00
|
|
|
|
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_logging basic test"
|