"This might be a good opportunity to create a MySQL facts module that returns information about a server,"
While you're free to do that, not sure we want this -- Trying to control over-proliferation of ansible-facts modules if possible as here the register seems pretty easy. If it returns a giant ton of other things someone needs, that's one thing -- but if it just sounds useful -- I'd suggest dragging your feet a bit :) On Wed, Jun 11, 2014 at 3:33 PM, Paul Durivage <[email protected]> wrote: > Hi Andrew, > > Determining how a task should be treated as "changed" is can be controlled > using the changed_when directive. See the documentation: > http://docs.ansible.com/playbooks_error_handling.html#overriding-the-changed-result > > -name: check if DB exists > shell: mysql -u <user> -p <password> -h <host> 'show databases;' | grep > {{ db_name }} > register: dbstatus > changed_when: dbstatus.rc == 1 and not dbstatus.stdout > > Or something like that. Grep returns a 1 in no lines match, and there > won't be any standard out if no lines match. > > This might be a good opportunity to create a MySQL facts module that > returns information about a server, from which you can use logic to decide > how to implement tasks. Just a thought. > > > > -- > 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/CAK6JQEGtNRAcsdnTpAg7wFneZkKuBXifdh8_P%3DhHA-HenSqY6Q%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAK6JQEGtNRAcsdnTpAg7wFneZkKuBXifdh8_P%3DhHA-HenSqY6Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > 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/CA%2BnsWgz1H%3DxJOK18kK0MLoUiYfyjJYvyi2MEN2aZso2%3DSCCkcw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
