project with router cisco - need help

Hi everyone!

Im new on AWX and I want to learn about network automation. Im trying to do a template from AWX to a router cisco, but I get an error of ssh. Next the step I did.

I did a testing environment with:

  • GNS3 VM to emulate routers (cisco c3725 and CSR1000v).
  • AWX on a K8s cluster, installed with awx-operator and kustomize.

The routers are running without problems, I can ping them after configuring the project with a cloud:
Topology:

Config:

Ping from server:

Then I try a playbook from the server installing collections ansible.netcommon and cisco.ios and python ansible-pylibssh and paramiko.
Playbook:

(attachments)







Did you try to SSH from the K8 master to the router?

try set gather_facts: no inside your playbook. it should work.

Hi guys!

Thanks for the replies.

The problem was outside of K8s and the router.

The thing was that I was using the subnet 192.168.0.0/16 for the cluster and my local network was /24, so when the pod of AWX in charge of the job had an IP that my LAN router didn’t know, he send the traffic to the gateway and I ssh connection never succeed. To solve the problem I changed my LAN configuration and now everything works fine.

Thanks and we keep in touch

Hi Perkins,

Sorry but can i check if you happen to have community.general in the collections ?
I was trying to build a custom ee too but they all failed without any success. Using your ee, I was able to at least query my routers.

Are you using ubuntu to build the ee ?

Hi,

Yes Im using ubuntu to build the ee. I follow this steps:

run ansible-builder
sudo ansible-builder build --tag --container-runtime docker

check
sudo docker images

tag image
sudo docker tag : /:

push to docker hub
sudo docker push /:

to test
create a directory with hosts and playbooks
~/exmaple
/inventory
/hosts
/project
/test.yml
RUN ANSIBLE-RUNNER
sudo ansible-runner run --process-isolation --process-isolation-executable docker --container-image /: -p test.yml ~/example

My files are:
execution-environment.yml

Hi Perkins,

Thank you very much for the good information.
I followed Yr steps and the error is at this step.

Seems this is not allowed.

build_arg_defaults:
EE_BASE_IMAGE: ‘quay.io/ansible/ansible-runner:latest

Thank you

Hi Perkins,

Do you mind if I get your help to add community.general to the ee you built?

Thanks

HI,

Good to know that was useful.

That line is optional, it is estranged that is causing a problem, you can comment those lines and give it a try

Thank you. Would you mind share the contents of ansible.cfg you have there in execution-environment file please ?

Thank you

Sure, its a basic conf file just with “host_key_checking = False”

config file for ansible – https://ansible.com/

===============================================

nearly all parameters can be overridden in ansible-playbook

or with command line flags. ansible will read ANSIBLE_CONFIG,

ansible.cfg in the current working directory, .ansible.cfg in

the home directory or /etc/ansible/ansible.cfg, whichever it

finds first

[defaults]

some basic default values…

inventory = /etc/ansible/hosts
#library = /usr/share/my_modules/
#module_utils = /usr/share/my_module_utils/
#remote_tmp = ~/.ansible/tmp
#local_tmp = ~/.ansible/tmp
#plugin_filters_cfg = /etc/ansible/plugin_filters.yml
#forks = 5
#poll_interval = 15
#sudo_user = root
#ask_sudo_pass = True
#ask_pass = True
#transport = smart
#remote_port = 22
#module_lang = C
#module_set_locale = False

plays will gather facts by default, which contain information about

the remote system.

Thank you for the help.

i followed the contents of the files. and got this error twice… Did you see this error too ?

(builder) awx@Ubuntu-virtual-machine:~/ansible-builder$ ansible-builder build --tag tester/custom-ee:1.0.0 --container-runtime docker
Running command:
docker build -f context/Dockerfile -t tester/custom-ee:1.0.0 context
Running command:
docker run --rm -v /home/awx/ansible-builder/builder/lib/python3.10/site-packages/ansible_builder:/ansible_builder_mount:Z tester/custom-ee:1.0.0 python3 /ansible_builder_mount/introspect.py
File context/_build/bindep_combined.txt had modifications and will be rewritten
File context/_build/requirements_combined.txt had modifications and will be rewritten
Running command:
docker build -f context/Dockerfile -t tester/custom-ee:1.0.0 context

…showing last 20 lines of output…
File “/tmp/pip-install-jlyspaew/pycurl_ea0d3bb2337043e5bcb85a3b36ff7f2a/setup.py”, line 970, in
ext = get_extension(sys.argv, split_extension_source=split_extension_source)
File “/tmp/pip-install-jlyspaew/pycurl_ea0d3bb2337043e5bcb85a3b36ff7f2a/setup.py”, line 634, in get_extension
ext_config = ExtensionConfiguration(argv)
File “/tmp/pip-install-jlyspaew/pycurl_ea0d3bb2337043e5bcb85a3b36ff7f2a/setup.py”, line 93, in init
self.configure()
File “/tmp/pip-install-jlyspaew/pycurl_ea0d3bb2337043e5bcb85a3b36ff7f2a/setup.py”, line 234, in configure_unix
raise ConfigurationError(msg)
main.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory: ‘curl-config’
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
The command ‘/bin/sh -c /output/install-from-bindep && rm -rf /output/wheels’ returned a non-zero code: 1

I see that error while I was adding some collection that couldn’t be added. Maybe try to do a smaller EE with only the necessary collections you need and then add more

HI, i am trying to achieve backing up my routers using awx, i am able to push commands on the router and interact with router using ansible
since the code is running inside a container, i am not able to get the file out of the container as it gets deleted after execution
can someone advise, how we can get this output be stored on the host and then get it synced with gitlab

highly appreciate any help
:slight_smile: