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

Running SSH commands on CVM via Ansible


Forum|alt.badge.img+2
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

Best answer by itguyadam

@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.
View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

4 replies

  • Voyager
  • 2 replies
  • July 2, 2019
Can you provide a sample of your playbook?

Forum|alt.badge.img+2
  • Author
  • Adventurer
  • 7 replies
  • Answer
  • July 24, 2019

rhunt
Forum|alt.badge.img+4
  • Trailblazer
  • 18 replies
  • July 25, 2019
@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.

Forum|alt.badge.img+2
  • Author
  • Adventurer
  • 7 replies
  • July 26, 2019
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 🙂