I am two days now into ansible and I love everything it can do. My problem is that ansible does not like my yaml :-). My below playbook keeps throwing errors when I run a --check on it. Basically I want the update rpm pulled down and put in /tmp. Then I want to check if a user account exists. If not I want it to stop and inform me that the user doesn’t exist. I looked at the fail instructions and I followed it but I guess I am missing something. Thank you in advanced for your help.
error
The offending line appears to be:
- fail:
msg: “User Splunk does not exist, stopping install”
^ here
playbook
- name: install splunk forwarder Binaries
hosts: all
gather_facts: True
tasks:
- name: download splunk forwarder RPM
get_url:
url: http://server/RPM/update-6.5.3-36937ad027d4-linux-2.6-x86_64.rpm
dest: /tmp/update-6.5.3-36937ad027d4-linux-2.6-x86_64.rpm
mode: 777
action: shell /usr/bin/getent passwd nix| /usr/bin/wc -l | tr -d ‘’
register: user_exist
when: user_exist.stdout == 0
- fail:
msg: “User nix does not exist, stopping install”
when: user_exist.stdout == 0