Forum Discussion
Zuke
Cirrostratus
Feb 05, 2021Ansible bigip_command module error message
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 |...
Mike_A
Nimbostratus
Feb 15, 2021I 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.
"executed_commands": [
"tmsh -c \\\"netstat -rn \\\" | grep \\\"^0.0.0.0\\\" | grep -v mgmt | awk \\'{print \\$2}\\'"
]
"failed": false,Here is what is in my playbook.
tasks:
- name: Default Gateway
bigip_command:
commands:
- netstat -rn | grep "^0.0.0.0" | grep -v mgmt | awk '{print $2}'
provider: "{{ provider }}"
register: f5_gateway_output
- debug:
var: f5_gateway_outputZuke
Cirrostratus
Feb 17, 2021Mike your whitespace looks off. I pasted your playbook as printed above to yamllint.com and got errors. Try this.
---
tasks:
-
bigip_command:
commands:
- "netstat -rn | grep \"^0.0.0.0\" | grep -v mgmt | awk '{print $2}'"
provider: "{{ provider }}"
name: "Default Gateway"
register: f5_gateway_output
-
debug:
var: f5_gateway_outputHelp guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects