Weekly Journal 22 - Ansible & Shell Scripts

Synopsis

I’ve been trying to run a shell script in Ansible without success.

Ansible & Shell Scripts

I am super-frustrated with Ansible at the moment. I have a playbook that I have been working on that needs to grab some data from an API.

I have written a small shell script that pulls the data from the API, but I can’t seem to get it work when running it with Ansible. It works fine when run on my local system, so I’m convinced it has something to do with the target server. I have been trying to test the script using the Ansible container and I am wondering if that might be part of my problem. Maybe the shell in my container is a minimalist shell like dash or ash, and I’m using a bash-specific feature or something.

I have tried running the script inline, and externally using the shell and command modules. Each time the script hangs in the middle, and the playbook and ends up timing out. I think my next step is to try running the script against a real target server instead of inside the container.

What’s Next?

I am going to try running my Ansible playbook against a real server instance, and possibly asking one of my Ansible developers for some assistance.