"HTTP 405 - Method Not Allowed" when attempting vROPs Telegraf install with SaltStack
| 2 minutes
VMware vRealize Suite vRealize Operations Manager Telegraf vRealize SaltStack Config

I was trying to install the vRealize Operations Telegraf agent on my VMs by following the documentation. I wrote the steps out in a Salt state file:

unzip:
  pkg.installed
  
install-telegraf:
  cmd.script:
    - source: https://cloudproxy.domain.tld/downloads/salt/download.sh 
    - name: /tmp/download.sh -o install -v vrops.domain.tld -u admin -p p@ssw0rd
    - mode: '0777'

Salt takes the source and puts it in the location under name, executing it with the included arguments. However, everytime it ran I would get this:

Failed to get vROps Token. Error code: 400

Downloading the download.sh script and running it interactively on the target machine also failed (using the default ubuntu account) and displayed the same error as above. Using sudo to elevate and execute the script interactively was successful.

After a few dozen attempts tweaking the above, I eventually settled on wrapping the download.sh script in another script delivered by SaltStack:

#!/bin/bash
curl -k https://cloudproxy.domain.tld/downloads/salt/download.sh -o /tmp/download.sh
chmod +x /tmp/download.sh
sudo sh -c /tmp/download.sh -o install -v vrops.domain.tld -u admin -p p@ssw0rd

The above script was stored in SaltStack under /vrops/telegraf/install.sh and now I was able to use SaltStack to fetch this new script and perform the installation:

unzip:
  pkg.installed

download-runner:
  file.managed:
    - source: salt://vrops/telegraf/install.sh
    - name: /tmp/install.sh
    - mode: '0777'
    
install_vrops_agent:
  cmd.run:
    - name: /tmp/install.sh
    - retry:
        attempts: 5
        until: True
        interval: 60

Notice the retry instruction for install_vrops_agent. I found that on a fresh deployment out of vRA a VM wouldn’t necessarily be in vROPs at the time the installer.sh script would run and would subsequently fail. Having the retry there allowed Salt to re-run the script until a suitable exit code was returned.

About Stellios Williams
Senior Cloud Solutions Architect - Service Providers VMware
This is my personal tech related blog for anything private and public cloud - including homelabs! My postings are my own and don’t necessarily represent VMware’s positions, strategies or opinions. Any technical guidance or advice is given without warranty or consideration for your unique issues or circumstances.
Comments
comments powered by Disqus
Advertisement