ansistrano / deploy

Ansible role to deploy scripting applications like PHP, Python, Ruby, etc. in a capistrano style
https://ansistrano.com
MIT License
2.37k stars 343 forks source link

REVISION file copy operation fails with unprivileged user #277

Closed ctorgalson closed 6 years ago

ctorgalson commented 6 years ago

While trying to use Deploy to deploy to a server where the Ansible ssh user does not have sudo, the role will fail on the REVISION copy operation in update-code.yml:

```json fatal: [example.com]: FAILED! => { "failed": true, "msg": "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user (rc: 1, err: OpenSSH_7.4p1, LibreSSL 2.5.0\r\ndebug1: Reading configuration data /Users/username/.ssh/config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 81953\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\nchown: changing ownership of '/tmp/ansible-tmp-1515268463.91-198282885552037/': Operation not permitted\nchown: changing ownership of '/tmp/ansible-tmp-1515268463.91-198282885552037/source': Operation not permitted\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\n}). For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user" } ```

This can be fixed by replacing the copy operation with a lineinfile operation without causing any problems that I can see. Pull request forthcoming shortly to demonstrate.

ctorgalson commented 6 years ago

Can't reproduce the issue myself, no reason for anyone else to spend any time on it :)