{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/17353","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/17353/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/17353/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/17353/events","html_url":"https://github.com/ansible/ansible/issues/17353","id":174577719,"number":17353,"title":"Error \"invalid selinux context\" in multiple modules when using symbolic links to NFS filesystems","user":{"login":"kjdms","id":21689533,"avatar_url":"https://avatars.githubusercontent.com/u/21689533?v=3","gravatar_id":"","url":"https://api.github.com/users/kjdms","html_url":"https://github.com/kjdms","followers_url":"https://api.github.com/users/kjdms/followers","following_url":"https://api.github.com/users/kjdms/following{/other_user}","gists_url":"https://api.github.com/users/kjdms/gists{/gist_id}","starred_url":"https://api.github.com/users/kjdms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kjdms/subscriptions","organizations_url":"https://api.github.com/users/kjdms/orgs","repos_url":"https://api.github.com/users/kjdms/repos","events_url":"https://api.github.com/users/kjdms/events{/privacy}","received_events_url":"https://api.github.com/users/kjdms/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-01T17:13:13Z","updated_at":"2016-09-01T17:13:13Z","closed_at":null,"body":"<!---\r\nPlease do not report issues/requests related to Ansible modules here !!\r\n\r\nReport them to the appropriate modules-core or modules-extras project:\r\n  - https://github.com/ansible/ansible-modules-core/issues\r\n  - https://github.com/ansible/ansible-modules-extras/issues\r\n\r\nAlso verify first that your issue/request is not already reported in GitHub\r\n-->\r\n\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest: -->\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\n<!--- Name of the plugin/task/feature -->\r\ntemplate module, copy module\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from “ansible --version” between quotes below -->\r\n```\r\nansible 2.1.0.0\r\n```\r\n\r\n##### CONFIGURATION\r\n<!---\r\nMention any settings you have changed/added/removed in ansible.cfg\r\n(or using the ANSIBLE_* environment variables).\r\n-->\r\nansible_managed = Ansible managed: {file} on {host}\r\nbecome=True\r\nbecome_method=sudo\r\n\r\nAll other settings are default. No ANSIBLE_* environment variables have been created or modified.\r\n\r\n##### OS / ENVIRONMENT\r\n<!---\r\nMention the OS you are running Ansible from, and the OS you are\r\nmanaging, or say “N/A” for anything that is not platform-specific.\r\n-->\r\nAnsible control server: RHEL 6.8\r\nManaged node: RHEL 7.2\r\n\r\n##### SUMMARY\r\n<!--- Explain the problem briefly -->\r\nTemplate and copy modules fail to generate a file when...\r\n1. the destination is a symlink to an NFS filesystem, and...\r\n2. selinux is enabled and in permissive mode.\r\n\r\nThe file can be generated successfully if...\r\n1. the destination directory is not a symlink, or ...\r\n2. the file already exists, or ...\r\n3. selinux is disabled\r\n\r\n##### STEPS TO REPRODUCE\r\n<!---\r\nFor bugs, show exactly how to reproduce the problem.\r\nFor new features, show how the feature would be used.\r\n-->\r\n1. Enable selinux in permissive mode.\r\n\r\n2. Create a symlink to a directory under a mounted NFS share. In my case, the mount point is /mnt/nfsshare and it contains a directory named \"configuration\". The symlink is created as /var/www/vhosts/foo/configuration and the target is \"/mnt/nfsshare/configuration\". NFS share export options: (rw,relatime,vers=3,rsize=65536,wsize=65536,namlen=255,soft,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.10.88.249,mountvers=3,mountport=4046,mountproto=udp,local_lock=none,addr=10.10.88.249)\r\n\r\n3. Run a task using the template or copy module to generate a new file with the symlink as the destination directory. In my example, {{ project_root }} is \"/var/www/vhosts/foo\".\r\n\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```\r\n- name: ensure file is copied\r\n  copy:\r\n    src: testfile\r\n    dest: \"{{ project_root }}/configuration/testfile\"\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<!--- What did you expect to happen when running the steps above? -->\r\nThe file \"testfile\" should be generated.\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\r\nNo file is generated.\r\n\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\nfatal: [lnxvmbagd08.smrcy.com]: FAILED! => {\"changed\": false, \"checksum\": \"648a6a6ffffdaa0badb23b8baf90b6168dd16b3a\", \"cur_context\": [\"system_u\", \"object_r\", \"nfs_t\", \"s0\"], \"failed\": true, \"gid\": 0, \"group\": \"root\", \"input_was\": [\"system_u\", \"object_r\", \"httpd_sys_content_t\", \"s0\"], \"invocation\": {\"module_args\": {\"backup\": false, \"content\": null, \"delimiter\": null, \"dest\": \"/var/www/vhosts/foo/configuration/testfile\", \"directory_mode\": null, \"follow\": false, \"force\": true, \"group\": null, \"mode\": null, \"original_basename\": \"testfile\", \"owner\": null, \"regexp\": null, \"remote_src\": null, \"selevel\": null, \"serole\": null, \"setype\": null, \"seuser\": null, \"src\": \"/home/svcansible/.ansible/tmp/ansible-tmp-1472748695.01-260071994165796/source\", \"validate\": null}}, \"mode\": \"0664\", \"msg\": \"invalid selinux context: [Errno 95] Operation not supported\", \"new_context\": [\"system_u\", \"object_r\", \"httpd_sys_content_t\", \"s0\"], \"owner\": \"root\", \"path\": \"/var/www/vhosts/foo/configuration/.ansible_tmpLeFmGitestfile\", \"secontext\": \"system_u:object_r:nfs_t:s0\", \"size\": 12, \"state\": \"file\", \"uid\": 0}\r\n```\r\n"}}
{"actor":{"display_login":"kjdms"}}