On Fri, May 17, 2019 at 10:36 AM Dan Linder <d...@linder.org> wrote:
>
>
> Your second question:
>>
>> But when i run my script with module command or script or shell, the state 
>> is changed but i'm not rassure if all task in my script is execut ...?
>
>
> When you use the `script:` module, anything that script does on your remote 
> system is outside of the control of Ansible.
>
> It is up to you or the developer of the script to ensure that "all task in my 
> script [are] executed".  Does your script have adequate error checking, does 
> it check for dependencies with other tools, is it running as the right 
> account?
>
> Your first question:
>>
>> I want verify if my script is well execut and all task in my script is ok.
>
>
> Are you asking how you can setup your playbook so that Ansible can determine 
> if the script is executable on the remote machine?
>
> If you like, you could add some sanity checking to the top of the "script.sh" 
> that only executes with a specific flag you pass to it from the Ansible 
> execution.  For example, if you add a simple "if" condition to it that looks 
> for a command argument `--test_by_ryad`, when that argument is found, the 
> script does whatever checking you need, then exits with a successful exit 
> code (0), or exits with a failure (1) if it is not.  You then setup a two 
> step playbook:
>
> - name: "Verify my script"
>   script: ./script.sh --test_by_ryad
>   delegate_to: localhost
>
> - name: "Execut my script shell"
>   script: ./script.sh
>   register: result
>   delegate_to: localhost
>
> If the first "Verify my script" will run your script in your "test mode" and 
> if it exits with a failure, the playbook will stop.  If it exits successfully 
> it will continue to execute the script without your test parameter and do 
> whatever your script is designed to do.
>
      I really think he is talking about how to use when to execute a
task and/or include a task list.

> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/b906c39d-e237-4d93-b817-1118199818c4%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAHEKYV7zfvRJOZ4%2BUb44X_Fc9MN1T454drWZSvmZKmervMTWzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to