Running SSH commands on CVM via Ansible | Nutanix Community
Skip to main content
Hello,



Just wondering if there is anything special about running CVM commands via ansible or other non-interactive session tools? The ansible ping module works just fine but when I start using Nutanix specific commands i get errors telling me that "no such file exists." The commands i'm running are "cluster status" and "ncli rsyslog-config get-status"



These obviously work in a regular interactive session but not with ansible. Am i missing a path variable declaration or something? Are the commands only available via interactive sessions(if that is even a thing)?



Thanks



Update: a coworker who is better at linux than I am said that the profile probably isn't loaded the same so I need to fully source all the commands. So right now I'm doing my best to find them and running them that way. So far so good.



/home/nutanix/cluster/bin/cluster status
Can you provide a sample of your playbook?
@sca1178



https://github.com/AD-Code/Automation/blob/master/ansible/nutanix_cluster_baseline/tasks/configure_cluster/syslog_config.yml



That is my syslog task list.
@itguyadam

I had started down this road and almost verbatim have the same code you have there. Thanks for posting it in github. It helped me validate the work that we were already doing in this space.

This is a really great example of how to utilize ansible for the nutanix platform. We also added in cvm password changes into the build/desired state. Unfortunately I can't post the code publicly.
Thanks @rhunt i'm happy to hear i'm not the only one trying to create a desired state tool for clusters. I'm also happy to hear that what I created wasn't so crazy that it didn't make any sense to anyone 🙂