diff --git a/.github/workflows/containerlab-actions.yml b/.github/workflows/containerlab-actions.yml index 483b5a5..d7e1deb 100644 --- a/.github/workflows/containerlab-actions.yml +++ b/.github/workflows/containerlab-actions.yml @@ -6,12 +6,13 @@ jobs: runs-on: self-hosted steps: - uses: actions/checkout@v4 - - run: ls - - run: pwd - - run: echo "REPO_NAME=${{ github.event.repository.name }}" - - run: whoami + # - run: ls + # - run: pwd + # - run: echo "REPO_NAME=${{ github.event.repository.name }}" + # - run: whoami - run: ansible-playbook ~/clab_files/ansible_files/01_run_clab.yml -i containerlab_test/ansible-inventory.yml - + - run: ansible-playbook containerlab_test/testcase1.yml -i containerlab_test/ansible-inventory.yml + - name: Destroy the Containerlab if: always() run: ansible-playbook ~/clab_files/ansible_files/02_destroy_clab.yml \ No newline at end of file diff --git a/containerlab_test/test_case1.yml b/containerlab_test/test_case1.yml new file mode 100644 index 0000000..f15c185 --- /dev/null +++ b/containerlab_test/test_case1.yml @@ -0,0 +1,23 @@ +--- +- name: cEOS Config + hosts: ceos + gather_facts: yes + tasks: + - name: Retrieve VLAN configuration + eos_command: + commands: show vlan + register: vlan_output + + - name: Check if specific VLAN is present + set_fact: + vlan_present: "{{ 'VLAN 100' in vlan_output.stdout[0] }}" + + - name: Fail if VLAN is not present + fail: + msg: "VLAN 10 is not present on the switch." + when: not vlan_present + + - name: Debug message if VLAN is present + debug: + msg: "VLAN 10 is present on the switch." + when: vlan_present \ No newline at end of file