How about detecting the changed task(s) from within the playbook itself and 
create another task that calls a Jenkins API (assuming that's possible)?
Eg:
- name: Check for divergence
  command: <check_for_divergence.sh>
  register: is_diverged

- name: Call Jenkins to un-diverge
  command: <cool Jenkins command or API call>
  when: is_diverged | changed




On Thursday, 28 July 2016 12:32:43 UTC-6, Łukasz Górski wrote:
>
> Hi,
>
> is there any sensible option to make ansible-playbook exit with non-0 exit 
> code if there are any changes to be made to target hosts?
>
> The rationale for this is: we want to start using Jenkins to test if our 
> production infrastructure has not diverged from the state described in 
> Ansible roles and playbooks. It seems to be a good idea to run the 
> playbooks in check mode and report any changes, but apart from parsing the 
> playbook run output with shell tools, we haven't found (yet) any reasonable 
> solution to only detect (successful) changes and not failures.
>
> It's quite likely the approach is not really the best and there is some 
> simple and elegant option to achieve the same result (e.g. some Jenkins 
> plugin). We'll be happy with anything that works; thank you in advance for 
> any ideas and comments :)
>
> -- 
> *Łukasz Górski*
> Administrator Systemu Linux
> e-mail: l.go...@trojmiasto.pl <javascript:>
> Tel. 058 321 95 65 Kom. <http://trojmiasto.pl> 
> Moje miasto to Trójmiasto!
> ------------------------------
> Trojmiasto.pl Sp. z o.o. ul. Wały Piastowskie 1, 80-855 Gdańsk
> tel: 58 321-95-00 fax: 58 321-95-13 e-mail: in...@trojmiasto.pl 
> <javascript:>
> NIP 583-30-12-490, REGON 220563678
> Sąd Rejonowy Gdańsk-Północ w Gdańsku, VII Wydział Gospodarczy Krajowego 
> Rejestru Sądowego, KRS 0000300002, Kapitał zakładowy 2 150 000 PLN 
> [image: fb] <http://www.facebook.com/trojmiastopl> Trojmiasto.pl na 
> Facebooku. Dołącz do nas! <http://www.facebook.com/trojmiastopl> 
>

-- 
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/87f583f9-178c-462b-9698-2d72a350889c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to