ok thank you,
I will try to find a way to use the when condition then.
Le mardi 24 mai 2016 16:33:38 UTC+2, Kai Stian Olstad a écrit :
>
> On 24. mai 2016 12:50, fanvalt wrote:
> > Hello,
> >
> > I want to check if a process to run on my server by using the ps
> command:
> > - name: Test if openhr runs
> > shell: ps -ef | grep -v grep | grep {{ ansible_user }} | grep
> dispatcher
> > | grep {{ rep_user }}/{{ openhrname }}/bin
> > register: procopenhr
> >
> > I receive the following error message, I cannot figure out what's wrong
> > with my command:
> >
> > TASK [openhr : Test if openhr runs]
> > ******************************************
> > fatal: [localhost]: FAILED! => {"changed": true, "cmd": "ps -ef | grep
> -v
> > grep | grep fval | grep dispatcher | grep home/fval/openhr/bin",
> "delta":
> > "0:00:00.011877", "end": "2016-05-24 12:36:58.184606", "failed": true,
> > "rc": 1, "start": "2016-05-24 12:36:58.172729", "stderr": "", "stdout":
> "",
> > "stdout_lines": [], "warnings": []}
> >
> > I tried with quoting the last grep, without success: "grep {{ rep_user
> > }}/{{ openhrname }}/bin"
> >
> > What is wrong ?
>
> When grep doesn't find the string it will exit with 1.
> Ansible threat this("rc": 1) as a failure, you can change this behaviour
> with ignore_errors, failed_when or changed_when depending of what you
> try to achieve.
>
> You can read more about it here:
> https://docs.ansible.com/ansible/playbooks_error_handling.html
>
>
> --
> Kai Stian Olstad
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/11984dbe-ffb1-45db-ab33-6f47c5469522%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.