Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network Automation Basics - Surveys #265

Closed
carlosfparada opened this issue Nov 16, 2022 · 4 comments
Closed

Network Automation Basics - Surveys #265

carlosfparada opened this issue Nov 16, 2022 · 4 comments
Assignees

Comments

@carlosfparada
Copy link

There are a couple of issues with this demo.

  1. The variable name of the second question is sometimes referred as banner_type and others as net_type (sample image, initial text, guide text).
  2. Validation check fails on second exercise (create survey) using the provided values. I tried with several combinations of variable names (referred in 1.), not setting login as default (as it is when you skip the exercise), but nothing works.
    Best regards
    Carlos Parada
@IPvSean
Copy link
Collaborator

IPvSean commented Sep 1, 2023

Sorry for the delay here, I somehow missed this issue and investigating now.

@IPvSean
Copy link
Collaborator

IPvSean commented Sep 1, 2023

the lab is now updated to AAP 2.4 on RHEL9 and I updated the Cisco CSR image from 17.3.1 to 17.3.9, testing now

@IPvSean
Copy link
Collaborator

IPvSean commented Sep 1, 2023

The variable name of the second question is sometimes referred as banner_type and others as net_type (sample image, initial text, guide text).

This is fixed, good find!

Validation check fails on second exercise (create survey) using the provided values. I tried with several combinations of variable names (referred in 1.), not setting login as default (as it is when you skip the exercise), but nothing works.

the check for the 2nd exercise... not written well, I have temporarily fixed it for now with a simpler check... will circle back next week to write a better check. Basically it would fail if even a capital letter was off slightly, which is stupid IMHO and not the goal of the exercise.

Thank you for opening the issue!

@IPvSean
Copy link
Collaborator

IPvSean commented Sep 6, 2023

I have a better test in there now:
image

Here is the test if you are curious

#!/bin/bash

tee /home/rhel/check_challenege_2.yml << EOF
---
- hosts: localhost
  vars: 
    desired_job_template: 'Network-Banner'
  tasks:
    - name: retrieve Network-Banner job template
      set_fact: 
        network_banner_exist: "{{ query('awx.awx.controller_api', 'job_templates', query_params={ 'name': desired_job_template }, host='localhost', username='admin', password='ansible123!', verify_ssl=False) }}"
 
    - name: print out network_banner_exist var
      debug: 
        msg: "{{ network_banner_exist }}"
      failed_when: network_banner_exist == []

    - name: fail when survey is not enabled
      debug: 
        msg: "Is a survey enabled for {{ desired_job_template }}? {{ network_banner_exist[0].survey_enabled }}"
      failed_when: not network_banner_exist[0].survey_enabled
EOF

sudo chown rhel:rhel /home/rhel/check_challenege_2.yml

su - rhel -c 'ansible-playbook /home/rhel/check_challenege_2.yml'

if [ $? -eq 0 ]; then
    echo OK
else
    /usr/bin/fail-message "The job 'Network-Banner' does not have the survey enabled"
fi

@IPvSean IPvSean closed this as completed Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants