mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.5 KiB
YAML
71 lines
1.5 KiB
YAML
6 years ago
|
---
|
||
|
- debug: msg="START cli/commit_label.yaml on connection={{ ansible_connection }}"
|
||
|
|
||
|
- name: setup
|
||
|
iosxr_config:
|
||
|
commands:
|
||
|
- no description
|
||
|
- no shutdown
|
||
|
parents:
|
||
|
- interface Loopback999
|
||
|
match: none
|
||
|
|
||
|
- name: get a unique and valid label
|
||
|
set_fact:
|
||
|
label: "ansible_{{ 1001 | random | to_uuid | truncate(20, true, '_') }}"
|
||
|
|
||
|
- name: configure device with a label and a comment
|
||
|
iosxr_config:
|
||
|
src: basic/config.j2
|
||
|
comment: "this is sensible commit message"
|
||
|
label: "{{ label }}"
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
|
||
|
- name: setup
|
||
|
iosxr_config:
|
||
|
commands:
|
||
|
- no description
|
||
|
- no shutdown
|
||
|
parents:
|
||
|
- interface Loopback999
|
||
|
match: none
|
||
|
|
||
|
- name: Try to commit with old label, fail with a msg that label is alreay used
|
||
|
iosxr_config:
|
||
|
src: basic/config.j2
|
||
|
label: "{{ label }}"
|
||
|
register: result
|
||
|
ignore_errors: true
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
- "'already used' in result.msg"
|
||
|
|
||
|
- name: setup
|
||
|
iosxr_config:
|
||
|
commands:
|
||
|
- no description
|
||
|
- no shutdown
|
||
|
parents:
|
||
|
- interface Loopback999
|
||
|
match: none
|
||
|
|
||
|
- name: Try to commit with invalid chars($) in label
|
||
|
iosxr_config:
|
||
|
src: basic/config.j2
|
||
|
label: 'ansible_iosxr_config_$'
|
||
|
register: result
|
||
|
ignore_errors: true
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
- "'only contain alphabets' in result.msg"
|
||
|
|
||
|
- debug: msg="END cli/commit_label.yaml on connection={{ ansible_connection }}"
|