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
|
|
|
|
nxos_logging:
|
|
|
|
dest: console
|
|
|
|
dest_level: 0
|
|
|
|
state: present
|
2017-08-17 08:39:13 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"logging console 0" in result.commands'
|
|
|
|
|
|
|
|
- name: Set up console logging again (idempotent)
|
|
|
|
nxos_logging:
|
|
|
|
dest: console
|
|
|
|
dest_level: 0
|
|
|
|
state: present
|
2017-08-17 08:39:13 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Delete/disable console logging
|
|
|
|
nxos_logging:
|
|
|
|
dest: console
|
|
|
|
dest_level: 0
|
|
|
|
state: absent
|
2017-08-17 08:39:13 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"no logging console" in result.commands'
|
|
|
|
|
|
|
|
- name: Delete/disable console logging (idempotent)
|
|
|
|
nxos_logging:
|
|
|
|
dest: console
|
|
|
|
dest_level: 0
|
|
|
|
state: absent
|
2017-08-17 08:39:13 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Logfile logging with level
|
|
|
|
nxos_logging:
|
|
|
|
dest: logfile
|
|
|
|
name: test
|
|
|
|
dest_level: 0
|
|
|
|
state: present
|
2017-08-17 08:39:13 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"logging logfile test 0" in result.commands'
|
|
|
|
|
|
|
|
- name: Configure facility with level
|
|
|
|
nxos_logging:
|
|
|
|
facility: daemon
|
|
|
|
facility_level: 0
|
2017-08-17 08:39:13 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-07-25 11:33:54 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"logging level daemon 0" in result.commands'
|
|
|
|
|
|
|
|
- name: remove logging as collection tearDown
|
|
|
|
nxos_logging:
|
|
|
|
aggregate:
|
|
|
|
- { dest: logfile, name: test, dest_level: 0, state: absent }
|
|
|
|
- { facility: daemon, facility_level: 0, state: absent }
|
2017-08-17 08:39:13 +00:00
|
|
|
provider: "{{ connection }}"
|
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-01-15 07:46:41 +00:00
|
|
|
|
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_logging basic test"
|