Created
January 6, 2021 20:45
-
-
Save IPvSean/93490212e528e7607c4e6e76da52d9b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: l2_interfaces example for blog | |
hosts: arista | |
gather_facts: false | |
tasks: | |
- name: merge configuration | |
arista.eos.eos_l2_interfaces: | |
config: | |
- name: Ethernet1 | |
mode: trunk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: l2_interfaces example for blog | |
hosts: arista | |
gather_facts: false | |
tasks: | |
- name: merge configuration | |
arista.eos.eos_l2_interfaces: | |
config: | |
- name: Ethernet1 | |
mode: trunk | |
register: example | |
- name: display output | |
debug: | |
msg: | |
- "before:" | |
- "{{ example.before | to_nice_yaml }}" | |
- "" | |
- "commands:" | |
- "{{ example.commands | to_nice_yaml }}" | |
- "" | |
- "{{ example.after | to_nice_yaml }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[sean@RHEL8 ~]$ ansible-playbook arista_example.yml -v -l rtr2 | |
Using /home/student1/.ansible.cfg as config file | |
PLAY [l2_interfaces example for blog] ************************************************************************************************************************************************************** | |
TASK [merge configuration] ************************************************************************************************************************************************************************* | |
changed: [rtr2] => changed=true | |
after: | |
- mode: trunk | |
name: Ethernet1 | |
- name: Loopback0 | |
- name: Tunnel0 | |
- name: Ethernet1 | |
- name: Tunnel1 | |
- name: Ethernet1 | |
ansible_facts: | |
discovered_interpreter_python: /usr/libexec/platform-python | |
before: | |
- name: Ethernet1 | |
- name: Loopback0 | |
- name: Tunnel0 | |
- name: Ethernet1 | |
- name: Tunnel1 | |
- name: Ethernet1 | |
commands: | |
- interface Ethernet1 | |
- switchport mode trunk | |
PLAY RECAP ***************************************************************************************************************************************************************************************** | |
rtr2 : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[sean@RHEL8 ~]$ ansible-playbook arista_example_2.yml | |
PLAY [l2_interfaces example for blog] ************************************************************************************************************************************************************** | |
TASK [merge configuration] ************************************************************************************************************************************************************************* | |
changed: [rtr4] | |
changed: [rtr2] | |
TASK [display output] ****************************************************************************************************************************************************************************** | |
ok: [rtr4] => | |
msg: | |
- 'before:' | |
- |- | |
- name: Ethernet1 | |
- name: Loopback0 | |
- name: Tunnel0 | |
- name: Ethernet1 | |
- '' | |
- 'commands:' | |
- |- | |
- interface Ethernet1 | |
- switchport mode trunk | |
- '' | |
- |- | |
- mode: trunk | |
name: Ethernet1 | |
- name: Loopback0 | |
- name: Tunnel0 | |
- name: Ethernet1 | |
ok: [rtr2] => | |
msg: | |
- 'before:' | |
- |- | |
- mode: trunk | |
name: Ethernet1 | |
- name: Loopback0 | |
- name: Tunnel0 | |
- name: Ethernet1 | |
- name: Tunnel1 | |
- name: Ethernet1 | |
- '' | |
- 'commands:' | |
- |- | |
- interface Ethernet1 | |
- switchport mode trunk | |
- '' | |
- |- | |
- mode: trunk | |
name: Ethernet1 | |
- name: Loopback0 | |
- name: Tunnel0 | |
- name: Ethernet1 | |
- name: Tunnel1 | |
- name: Ethernet1 | |
PLAY RECAP ***************************************************************************************************************************************************************************************** | |
rtr2 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 | |
rtr4 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment