Forum Discussion
Ansible bigip_command module error message
Mike 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_outputAgreed, 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.
tasks:
- name: Collect Big-IP Facts
bigip_command:
commands:
- "netstat -rn | grep \"^0.0.0.0\" | grep -v \"eth0\\|mgmt\""
provider: "{{ provider }}"
register: f5_audit_output
- debug:
var: f5_audit_outputHelp guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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