{"action":"closed","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5232","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5232/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5232/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5232/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/5232","id":182476644,"number":5232,"title":"Cron \"user\" parameter not working","user":{"login":"Jalle19","id":1106133,"avatar_url":"https://avatars.githubusercontent.com/u/1106133?v=3","gravatar_id":"","url":"https://api.github.com/users/Jalle19","html_url":"https://github.com/Jalle19","followers_url":"https://api.github.com/users/Jalle19/followers","following_url":"https://api.github.com/users/Jalle19/following{/other_user}","gists_url":"https://api.github.com/users/Jalle19/gists{/gist_id}","starred_url":"https://api.github.com/users/Jalle19/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jalle19/subscriptions","organizations_url":"https://api.github.com/users/Jalle19/orgs","repos_url":"https://api.github.com/users/Jalle19/repos","events_url":"https://api.github.com/users/Jalle19/events{/privacy}","received_events_url":"https://api.github.com/users/Jalle19/received_events","type":"User","site_admin":false},"labels":[{"id":437720344,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/affects_2.1","name":"affects_2.1","color":"5319e7","default":false},{"id":132571937,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/bug_report","name":"bug_report","color":"fbca04","default":false},{"id":414073372,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/waiting_on_maintainer","name":"waiting_on_maintainer","color":"d93f0b","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2016-10-12T09:24:47Z","updated_at":"2016-11-14T05:28:57Z","closed_at":"2016-11-14T05:28:57Z","body":"<!--- Verify first that your issue/request is not already reported in GitHub -->\n##### ISSUE TYPE\n\n<!--- Pick one below and delete the rest: -->\n- Bug Report\n##### COMPONENT NAME\n\ncron\n##### ANSIBLE VERSION\n\n<!--- Paste verbatim output from “ansible --version” between quotes below -->\n\n```\nansible 2.1.2.0\n  config file = /etc/ansible/ansible.cfg\n  configured module search path = Default w/o overrides\n```\n##### OS / ENVIRONMENT\n\n<!---\nMention the OS you are running Ansible from, and the OS you are\nmanaging, or say “N/A” for anything that is not platform-specific.\n-->\n\n`ansible-playbook` running as non-root user with `sudo` rights.\n##### SUMMARY\n\n<!--- Explain the problem briefly -->\n\nThe `user` parameter has no effect anymore, causing all cronjobs to be created under `root`'s crontab.\n##### STEPS TO REPRODUCE\n\n<!---\nFor bugs, show exactly how to reproduce the problem.\nFor new features, show how the feature would be used.\n-->\n\nI have a task like this:\n\n``` yaml\n- name: \"Create synchronize with S3 job\"\n  cron: name=\"synchronize {{ item.path }} with S3\"\n        user={{ s3sync_username }}\n        minute={{ s3sync_minute }}\n        hour={{ s3sync_hour }}\n        job=\"{{ awscli_path }} s3 sync {{ item.path }} s3://{{ item.bucket }}/{{ item.target_directory }} --region {{ s3sync_region }}\"\n  with_items: \"{{ s3sync_items }}\"\n```\n\n`s3sync_username` is set to `redacted-username`.\n\nThe `-vvv` output looks like this, here it looks like the correct user (`redacted-username` in this case) is being used:\n\n```\nTASK [s3sync : Create synchronize with S3 job] *********************************\ntask path: /home/redacted/redacted/releases/20161012065812/ansible/roles/s3sync/tasks/main.yml:1\n<redacted-production> ESTABLISH LOCAL CONNECTION FOR USER: redacted\n<redacted-production> EXEC /bin/sh -c '( umask 77 && mkdir -p \"` echo $HOME/.ansible/tmp/ansible-tmp-1476263611.76-148118275790898 `\" && echo ansible-tmp-1476263611.76-148118275790898=\"` echo $HOME/.ansible/tmp/ansible-tmp-1476263611.76-148118275790898 `\" ) && sleep 0'\n<redacted-production> PUT /tmp/tmppSYF3B TO /home/redacted/.ansible/tmp/ansible-tmp-1476263611.76-148118275790898/cron\n<redacted-production> EXEC /bin/sh -c 'chmod u+x /home/redacted/.ansible/tmp/ansible-tmp-1476263611.76-148118275790898/ /home/redacted/.ansible/tmp/ansible-tmp-1476263611.76-148118275790898/cron && sleep 0'\n<redacted-production> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '\"'\"'echo BECOME-SUCCESS-ayvnghugrmdwgsbpbocennoohvyvhzhj; LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python /home/redacted/.ansible/tmp/ansible-tmp-1476263611.76-148118275790898/cron; rm -rf \"/home/redacted/.ansible/tmp/ansible-tmp-1476263611.76-148118275790898/\" > /dev/null 2>&1'\"'\"' && sleep 0'\nok: [redacted-production] => (item={u'path': u'/home/redacted/backups', u'target_directory': u'database', u'bucket': u'redacted-backups'}) => {\"changed\": false, \"envs\": [], \"invocation\": {\"module_args\": {\"backup\": false, \"cron_file\": null, \"day\": \"*\", \"disabled\": false, \"env\": null, \"hour\": \"9\", \"insertafter\": null, \"insertbefore\": null, \"job\": \"/usr/local/bin/aws s3 sync /home/redacted/backups s3://redacted-backups/database --region eu-central-1\", \"minute\": \"0\", \"month\": \"*\", \"name\": \"synchronize /home/redacted/backups with S3\", \"reboot\": false, \"special_time\": null, \"state\": \"present\", \"user\": \"redacted-user\", \"weekday\": \"*\"}, \"module_name\": \"cron\"}, \"item\": {\"bucket\": \"redacted-backups\", \"path\": \"/home/redacted/backups\", \"target_directory\": \"database\"}, \"jobs\": [\"daily database backup\", \"weekly database backup\", \"remove obsolete daily backups\", \"remove obsolete weekly backups\", \"synchronize /home/redacted/backups with S3\"]}\n```\n##### EXPECTED RESULTS\n\nThe cronjob should be created for the specified user\n##### ACTUAL RESULTS\n\nThe cronjob is created for `root`\n"}}
{"actor":{"display_login":"ansibot"}}