1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

vyos net_system implementation (#25994)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2017-06-23 20:08:12 +05:30 committed by GitHub
parent 42b608db0c
commit 66f9e23e43
2 changed files with 69 additions and 0 deletions

View file

@ -13,4 +13,7 @@
- include: "{{ role_path }}/tests/eos/set_name_servers.yaml"
when: hostvars[inventory_hostname]['ansible_network_os'] == 'eos'
- include: "{{ role_path }}/tests/vyos/set_name_servers.yaml"
when: hostvars[inventory_hostname]['ansible_network_os'] == 'vyos'
- debug: msg="END cli/set_name_servers.yaml"

View file

@ -0,0 +1,66 @@
---
- debug: msg="START vyos/set_name_servers.yaml"
- name: setup
vyos_config:
lines:
- no ip name-server 1.1.1.1
- no ip name-server 2.2.2.2
- no ip name-server 3.3.3.3
match: none
provider: "{{ cli }}"
- name: configure name_servers
vyos_system:
name_servers:
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
provider: "{{ cli }}"
register: result
- assert:
that:
- result.changed == true
- result.commands|length == 3
- "'ip name-server 1.1.1.1' in result.commands"
- "'ip name-server 2.2.2.2' in result.commands"
- "'ip name-server 3.3.3.3' in result.commands"
- name: verify name_servers
vyos_system:
name_servers:
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
provider: "{{ cli }}"
register: result
- assert:
that:
- result.changed == false
- name: remove one
vyos_system:
name_servers:
- 1.1.1.1
- 2.2.2.2
provider: "{{ cli }}"
register: result
- assert:
that:
- result.changed == true
- result.commands|length == 1
- "'no ip name-server 3.3.3.3' in result.commands"
- name: teardown
vyos_config:
lines:
- no ip lookup source-interface
match: none
provider: "{{ cli }}"
ignore_errors: yes
# FIXME Copied from iosxr, not sure what we need here
- debug: msg="END vyos/set_name_servers.yaml"