This is a bug where it needs to note the check mode flag and bail out.

Normally this is an infrastructure all modules have access to but
synchronize is implemented a little differently so it can't leverage that.

Can you please file this as a bug on github.com/ansible/ansible?

Thanks!

Thanks!


On Mon, Feb 24, 2014 at 3:54 PM, Dimos Alevizos <[email protected]> wrote:

> Hi,
>
> I have a problem with the synchronize module on ansible 1.4. It seems it
> ignores the --check but I can't figure out why, the code seems fine to me.
>
> I created a simple playbook to experiment with the module :
> root@vader:ansible $ cat poppers-sync.yml
> ---
> - hosts: doverc1
>   user: root
>   tasks:
>   - name: static dovecot conf files
>     synchronize: src=/tmp/ansible/files/poppers/dovecot/
> dest=/tmp/dovecot/etc/dovecot/
>
> Looking at the code, when run with --check, synchronize should run rsync
> with --dry-run, however it doesn't :
>
>     cmd = '%s --delay-updates --compress --timeout=%s' % (rsync,
> rsync_timeout)
>     if module.check_mode:
>         cmd = cmd + ' --dry-run'
>
>
> root@vader:ansible $ /usr/bin/ansible-playbook poppers-sync.yml --check
> -v
>
> PLAY [doverc1]
> ****************************************************************
>
> GATHERING FACTS
> ***************************************************************
> ok: [doverc1]
>
> TASK: [static dovecot conf files]
> *********************************************
> changed: [doverc1] => {"changed": true, "cmd": "rsync --delay-updates
> --compress --timeout=10 --archive --rsh 'ssh -i /root/.ssh/id_dsa -o
> StrictHostKeyChecking=no' --out-format='<<CHANGED>>%i %n%L'
> /tmp/ansible/files/poppers/dovecot/ root@doverc1:/tmp/dovecot/etc/dovecot/",
> "msg": [".d..t...... ./", "<f+++++++++ README", "<f+++++++++
> antispam.sieve", "<f+++++++++ dovecot-dict-sql.conf.ext", "<f+++++++++
> dovecot-ldap.conf.ext", "<f+++++++++ dovecot.conf", "cd+++++++++ conf.d/",
> "<f+++++++++ conf.d/10-auth.conf", "<f+++++++++ conf.d/10-director.conf",
> "<f+++++++++ conf.d/10-logging.conf", "<f+++++++++ conf.d/10-mail.conf",
> "<f+++++++++ conf.d/10-master.conf", "<f+++++++++ conf.d/10-ssl.conf",
> "<f+++++++++ conf.d/15-lda.conf", "<f+++++++++ conf.d/20-imap.conf",
> "<f+++++++++ conf.d/20-lmtp.conf", "<f+++++++++ conf.d/20-pop3.conf",
> "<f+++++++++ conf.d/90-acl.conf", "<f+++++++++ conf.d/90-plugin.conf",
> "<f+++++++++ conf.d/90-quota.conf", "<f+++++++++ conf.d/90-sieve.conf",
> "<f+++++++++ conf.d/auth-checkpassword.conf.ext", "<f+++++++++
> conf.d/auth-deny.conf.ext", "<f+++++++++ conf.d/auth-ldap.conf.ext",
> "<f+++++++++ conf.d/auth-master.conf.ext", "<f+++++++++
> conf.d/auth-passwdfile.conf.ext", "<f+++++++++ conf.d/auth-sql.conf.ext",
> "<f+++++++++ conf.d/auth-static.conf.ext", "<f+++++++++
> conf.d/auth-system.conf.ext", "<f+++++++++ conf.d/auth-vpopmail.conf.ext",
> ""], "rc": 0}
>
> PLAY RECAP
> ********************************************************************
> doverc1                    : ok=2    changed=1    unreachable=0
>  failed=0
>
> (I've changed the output a bit to make it easier to read, don't pay
> attention)
>
> As you can see there's no "--dry-run" as it should.
> I even changed the module to output module.check_mode and the result was
> this :
>
> ok: [doverc1] => {"changed": false, "msg": false}
> (that was on a run I hadn't previously deleted the destination path so it
> reported correctly that there were no changes, but still claims that
> check_mode is false)
>
> Any ideas ?
> Has anyone else tried synchronize module with --check ?
>
> --
> 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/6734f6f3-db4b-4b85-b6d3-91d30b6be766%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAEVJ8QOYSeaU5u6CJaCKx5_y46xoOK%3D%3DY253An7n5anyyrzQbA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to