Command Path issue with serverspec, need steps for ansible

46 views Asked by At

I've installed serverspec on my server command to execute serverspec is serverspec-init. But this is working for me only when I do the full command path. /usr/local/lib/ruby/gems/2.7.0/gems/serverspec-2.41.5/bin/serverspec-init but when i do export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

serverspec-init command works fine

I need to update these steps into ansible can anyone help me out to do ansible steps

Thankyou

1

There are 1 answers

1
mdaniel On

You can provide an environment to both command: and shell:, and likely a bunch of other modules

- command: serverspec-init
  environment:
     PATH: "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"