ansible/ansible — pull request #3108 by lberruti (2013-06-03 15:34:27+00:00)
Title: Default mode for template files.

The default mode for the template files is 0644.

The template module lacks a default mode for the file, that is undefined and may be different depending on the environment. E.g., when the file must be created, and a ssh connection is used, the mode of the destination file is set to 0600, when paramiko is used it is set to 0644.

This is due to the fact that the _transfer_str() method creates the file through the mkstemp() method (from mkstemp doc: "The file is readable and writable only by the creating user ID") and the ssh copy conserves the mode of the file, while, evidently, paramiko uses the umask of the target machine.

NOTE. This patch could break a configuration where the 'mode' option was used (with a value different from 0644) and now it is no longer used. In this case the file mode is set to 0644 insted of being conserved to the current value.

[Test results: test_large_output fails in the parent commit too]