NOOB needs help with small ansible script.

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:

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

Try indenting the msg line. YAML is very fussy about spacing and indentation.

Still having issues. I completely started over and no luck. Ansible still complains, it is complaining about action and every time I change something it complains about another stanza.
Here is the error

ansible-playbook TEST -i hosts -C
ERROR! Syntax Error while loading YAML.

The error appears to have been in ‘/root/SPLUNK/TEST’: line 5, column 10, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

Here is my YAML playbook

You have problem with indentation, I do recommend reading the docs, start with this one,
https://docs.ansible.com/ansible/YAMLSyntax.html

And then read this one,
https://docs.ansible.com/ansible/playbooks_intro.html

Do look at the indentation that is 2 spaces in the examples.
In YAML, indentation is is essential.

Your indentation is still all over the place. Try:

`