Hey, Thank you for your answer guy !! :)
I will try find any solution for resolve this problem because Ansible is not also performly ... Regards, Le vendredi 17 mai 2019 17:10:38 UTC+2, Mauricio Tavares a écrit : > > On Fri, May 17, 2019 at 10:36 AM Dan Linder <[email protected] <javascript:>> > 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 [email protected] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > 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 [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/9c4afd01-2d4c-4830-979a-fe63285c7b1b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
