2018-08-21 17:11:18 +02:00
|
|
|
---
|
|
|
|
- debug: msg="START netconf_config junos/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- include_vars: "{{playbook_dir }}/targets/netconf_config/tests/junos/fixtures/config.yml"
|
|
|
|
|
|
|
|
- name: syslog file config- setup
|
|
|
|
junos_config:
|
|
|
|
lines:
|
|
|
|
- delete system syslog file test_netconf_config
|
|
|
|
|
|
|
|
- name: configure syslog file
|
|
|
|
netconf_config:
|
|
|
|
content: "{{ syslog_config }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'<name>test_netconf_config</name>' in result.diff.after"
|
|
|
|
|
|
|
|
- name: configure syslog file (idempotent)
|
|
|
|
netconf_config:
|
|
|
|
content: "{{ syslog_config }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2019-06-10 16:10:58 +02:00
|
|
|
- name: replace default operation fail
|
2018-08-21 17:11:18 +02:00
|
|
|
netconf_config:
|
|
|
|
content: "{{ syslog_config_replace }}"
|
|
|
|
default_operation: 'replace'
|
|
|
|
register: result
|
2019-06-10 16:10:58 +02:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "'Missing mandatory statement' in result.msg"
|
|
|
|
|
|
|
|
- name: replace syslog config with operation key in content
|
|
|
|
netconf_config:
|
|
|
|
content: "{{ syslog_config_replace }}"
|
|
|
|
register: result
|
2018-08-21 17:11:18 +02:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: test backup
|
|
|
|
netconf_config:
|
|
|
|
content: "{{ syslog_config }}"
|
|
|
|
backup: True
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "'backup_path' in result"
|
|
|
|
|
|
|
|
- name: syslog file config- teardown
|
|
|
|
junos_config:
|
|
|
|
lines:
|
|
|
|
- delete system syslog file test_netconf_config
|
|
|
|
|
2019-05-06 23:30:49 +02:00
|
|
|
- name: save config
|
|
|
|
netconf_config:
|
|
|
|
backup: yes
|
2019-06-10 16:10:58 +02:00
|
|
|
register: result
|
2019-05-06 23:30:49 +02:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "'backup_path' in result"
|
|
|
|
|
2018-08-21 17:11:18 +02:00
|
|
|
- debug: msg="END netconf_config junos/basic.yaml on connection={{ ansible_connection }}"
|