I’m trying to run a simple playbook to create a link in bash:
---
- name: Issue a command on the F5 devices
hosts: all
connection: local
environment:
F5_SERVER: '{{ ansible_host | default(inventory_hostname) }}'
gather_facts: false
tasks:
- name: Issue the command below
bigip_command:
commands:
- 'ln -sf /dev/sr0 /dev/cdrom'
However when I run this playbook, I’m getting an encoding error in AWX:
{
"msg": "'latin-1' codec can't encode characters in position 1-2: ordinal not in range(256)",
"exception": "
I’m wondering if the playbook is trying to run the command in TMOS rather than bash. Googling for that error returns a lot of Stack Overflow posts re: Python and needing to convert or define the script with UTF-8.
I have been having issues with BASH commands using the bigip_command module. What I see after the job is run is below. As you can see it is 100%, atleast in my case, abending tmsh -c to any command. The module says it runs bash. I have not been able to figure out how to do it yet.
No I haven’t successfully run a bash command with this module, and the documentation on the Ansible page is ambiguous. “Run TMSH and bash commands” headline and every example shows a command that is executed in TMSH. I’ve tried running this playbook with two commands given, the first command being “bash” but no luck. I still get the encoding error.
Agreed, there is very little documentation about running an actual bash command.
However, after some further testing, I was able to get my command working, but without “awk '{print $2}”, its not optimal but in any event I was able to get it to run. The odd part is a single “ls”, no flags, command throws an error.
I have no rhyme or reason as to why some work and some dont, I assume I’m/we are missing some fundamental piece to run bash commands.
Below is what is working for me right now, spacing is OK, it runs the play just not with the full command I want.