{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/23491","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/23491/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/23491/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/23491/events","html_url":"https://github.com/ansible/ansible/issues/23491","id":220946369,"number":23491,"title":"different behavior when setting sticky bit when using ansible / ansible-playbook","user":{"login":"moepot","id":1431733,"avatar_url":"https://avatars1.githubusercontent.com/u/1431733?v=3","gravatar_id":"","url":"https://api.github.com/users/moepot","html_url":"https://github.com/moepot","followers_url":"https://api.github.com/users/moepot/followers","following_url":"https://api.github.com/users/moepot/following{/other_user}","gists_url":"https://api.github.com/users/moepot/gists{/gist_id}","starred_url":"https://api.github.com/users/moepot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moepot/subscriptions","organizations_url":"https://api.github.com/users/moepot/orgs","repos_url":"https://api.github.com/users/moepot/repos","events_url":"https://api.github.com/users/moepot/events{/privacy}","received_events_url":"https://api.github.com/users/moepot/received_events","type":"User","site_admin":false},"labels":[{"id":437720699,"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.2","name":"affects_2.2","color":"5319e7","default":false},{"id":48276055,"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04","default":false},{"id":496359346,"url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":503572087,"url":"https://api.github.com/repos/ansible/ansible/labels/needs_triage","name":"needs_triage","color":"0e8a16","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-04-11T13:10:19Z","updated_at":"2017-04-11T20:43:37Z","closed_at":"2017-04-11T20:20:36Z","body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\nfile module\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.2.1.0\r\n  config file = /home/rewe/.ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\n```\r\n[defaults]\r\nhost_key_checking = False\r\nremote_user = root\r\nroles_path = ~/.ansible/roles/\r\nvault_password_file = ~/.ansible/vault_password_file\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\n```\r\nDistributor ID:\tUbuntu\r\nDescription:\tUbuntu 16.10\r\nRelease:\t16.10\r\nCodename:\tyakkety\r\n```\r\n\r\n##### SUMMARY\r\nIf I set a directory to mode 1777 (rwxrwxrwt / with sticky bit), using file module, there is different behavior, depending on using a playbook or an ad-hoc command.\r\n\r\n##### STEPS TO REPRODUCE (PLAYBOOK)\r\nGive 777 permissions and set sticky bit, using a playbook\r\n```\r\n$ ansible-playbook -i production build-agent.yml\r\n\r\nPLAY [build-agent] *************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [mima-bambooagent-06]\r\n\r\nTASK [fix permissions for /tmp/] ***********************************************\r\nchanged: [mima-bambooagent-06]\r\n\r\nPLAY RECAP *********************************************************************\r\nmima-bambooagent-06        : ok=2    changed=1    unreachable=0    failed=0   \r\n```\r\n\r\n##### ACTUAL RESULTS (PLAYBOOK)\r\n```\r\n[root@mima-bambooagent-06 bambooagent]# ls -l / | grep tmp\r\nd-wxrwS--t   15 root root 4096 11. Apr 15:03 tmp\r\n```\r\n\r\n##### STEPS TO REPRODUCE (AD-HOC)\r\nGive 777 permissions and set sticky bit, using the ad-hoc command:\r\n```\r\n$ ansible -i production build-agent -m file -a \"name=/tmp/ mode=1777\"\r\nmima-bambooagent-06 | SUCCESS => {\r\n    \"changed\": true, \r\n    \"gid\": 0, \r\n    \"group\": \"root\", \r\n    \"mode\": \"01777\", \r\n    \"owner\": \"root\", \r\n    \"path\": \"/tmp/\", \r\n    \"size\": 4096, \r\n    \"state\": \"directory\", \r\n    \"uid\": 0\r\n}\r\n```\r\n\r\n\r\n##### ACTUAL RESULTS (AD-HOC)\r\n```\r\n[root@mima-bambooagent-06 bambooagent]# ls -l / | grep tmp\r\ndrwxrwxrwt   15 root root 4096 11. Apr 15:04 tmp\r\n```\r\n\r\n\r\n\r\n\r\n##### playbook \"build-agent.yml\":\r\n```yaml\r\n---\r\n- hosts: build-agent\r\n  roles:\r\n#    - common\r\n#    - bamboo-agent\r\n  tasks:\r\n  - name: fix permissions for /tmp/\r\n    file:\r\n      name: /tmp/\r\n      mode: 1777\r\n```\r\n\r\n<!--- You can also paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n```\r\ndrwxrwsrwt   15 root root 4096 11. Apr 15:03 tmp\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/293394329","html_url":"https://github.com/ansible/ansible/issues/23491#issuecomment-293394329","issue_url":"https://api.github.com/repos/ansible/ansible/issues/23491","id":293394329,"user":{"login":"snowsky","id":4934898,"avatar_url":"https://avatars1.githubusercontent.com/u/4934898?v=3","gravatar_id":"","url":"https://api.github.com/users/snowsky","html_url":"https://github.com/snowsky","followers_url":"https://api.github.com/users/snowsky/followers","following_url":"https://api.github.com/users/snowsky/following{/other_user}","gists_url":"https://api.github.com/users/snowsky/gists{/gist_id}","starred_url":"https://api.github.com/users/snowsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snowsky/subscriptions","organizations_url":"https://api.github.com/users/snowsky/orgs","repos_url":"https://api.github.com/users/snowsky/repos","events_url":"https://api.github.com/users/snowsky/events{/privacy}","received_events_url":"https://api.github.com/users/snowsky/received_events","type":"User","site_admin":false},"created_at":"2017-04-11T20:43:37Z","updated_at":"2017-04-11T20:43:37Z","body":"Actually it is not caused by octal/decimal number, it is caused by this code[here](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/basic.py#L1072-L1082).\r\nI traced the codes for both ansible and ansible-playbook commands, and it is found the difference is that the mode is integer for ansible-playbook command but it is a string for ansible command.\r\n\r\nThen go back to the code, you will find that the logic causing this issue."}}
{"actor":{"display_login":"snowsky"}}