Bug in copy module for directory_mode?

436 views
Skip to first unread message

John Oliver

unread,
Aug 27, 2014, 2:31:59 PM8/27/14
to ansible...@googlegroups.com
This stanza:

- name: Upload 'macsecurity' plugin
  copy: src={{git_src}}/plugins/macsecurity
        dest=/var/www/html/roundcube/plugins/
        mode=0755
        directory_mode=yes
        group=roundcube

Fails with:

TASK: [roundcube-web | Upload 'macsecurity' plugin] *************************** 
failed: [jedis-test] => {"details": "invalid literal for int() with base 8: 'yes'", "failed": true, "gid": 500, "group": "roundcube", "md5sum": "59043bc3af8a7a48361bb2034b28cae8", "mode": "0700", "owner": "root", "path": "/var/www/html/roundcube/plugins/macsecurity/lib", "secontext": "unconfined_u:object_r:httpd_sys_content_t:s0", "size": 4096, "state": "directory", "uid": 0}
msg: mode needs to be something octalish

The error output just isn't correct or useful.  And the resulting permissions are wrong:

drwx-w----. root roundcube unconfined_u:object_r:httpd_sys_content_t:s0 macsecurity

It's setting the permissions of files inside that directory to 755, which isn't what I want, and:

[joliver@jedis-test ~]$ sudo ls -lZ /var/www/html/roundcube/plugins/macsecurity/ 
-rwxr-xr-x. root roundcube system_u:object_r:httpd_sys_content_t:s0 bootstrap_autoloader.php
-rwxr-xr-x. root roundcube system_u:object_r:httpd_sys_content_t:s0 composer.json
-rwxr-xr-x. root roundcube system_u:object_r:httpd_sys_content_t:s0 config.inc.php
drwx------. root roundcube unconfined_u:object_r:httpd_sys_content_t:s0 lib
-rwxr-xr-x. root roundcube system_u:object_r:httpd_sys_content_t:s0 macsecurity.php
-rwxr-xr-x. root roundcube system_u:object_r:httpd_sys_content_t:s0 phpunit-bootstrap.php
-rwxr-xr-x. root roundcube system_u:object_r:httpd_sys_content_t:s0 phpunit.xml
-rwxr-xr-x. root roundcube system_u:object_r:httpd_sys_content_t:s0 readme.txt


I've tried using seuser, but that isn't reliably applied, and doesn't make any difference (and nor should it).  Once I get all of my files up I'll set the context in one fell swoop, so I'm not worried about getting that correct during the transfer.

I can't use 'synchronize' as it bombs out complaining there's no tty, and I have to assume that'll be required on my targets.

I could zip or tar up the files, but I'm doing it that way I'm doing it because this directory is in git and may change.  I suppose I could create an archive every time the playbook is run, but that seems wasteful.

How can I reliably and correctly transfer a directory?

Michael DeHaan

unread,
Aug 27, 2014, 3:08:44 PM8/27/14
to ansible...@googlegroups.com
Directory mode takes something octalish, not a "yes".

So the error message seems quite right.

The permissions are not set because the module call failed.






--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/959e19b1-bbf0-480e-94b7-d87fb86cf4ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Oliver

unread,
Aug 27, 2014, 7:05:58 PM8/27/14
to ansible...@googlegroups.com
Thanks.

Maybe the docs could be a little clearer on this point?  When the default was given as "no", that made me assume the opposite would be "yes" :-)  From "When doing a recursive copy set the mode for the directories. ", I inferred that the mode of the parent would be inherited and recursively pushed down.

Michael DeHaan

unread,
Aug 27, 2014, 7:44:44 PM8/27/14
to ansible...@googlegroups.com
Docs say required "no", not default "no".



--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages