{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/43485","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/43485/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/43485/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/43485/events","html_url":"https://github.com/ansible/ansible/issues/43485","id":346165677,"node_id":"MDU6SXNzdWUzNDYxNjU2Nzc=","number":43485,"title":"file module should not print warning for link and state \"absent\"","user":{"login":"sseide","id":5168949,"node_id":"MDQ6VXNlcjUxNjg5NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/5168949?v=4","gravatar_id":"","url":"https://api.github.com/users/sseide","html_url":"https://github.com/sseide","followers_url":"https://api.github.com/users/sseide/followers","following_url":"https://api.github.com/users/sseide/following{/other_user}","gists_url":"https://api.github.com/users/sseide/gists{/gist_id}","starred_url":"https://api.github.com/users/sseide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sseide/subscriptions","organizations_url":"https://api.github.com/users/sseide/orgs","repos_url":"https://api.github.com/users/sseide/repos","events_url":"https://api.github.com/users/sseide/events{/privacy}","received_events_url":"https://api.github.com/users/sseide/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-31T12:28:42Z","updated_at":"2018-07-31T12:28:42Z","closed_at":null,"author_association":"NONE","body":"<!---\r\nVerify first that your issue/request is not already reported on GitHub.\r\nTHIS FORM WILL BE READ BY A MACHINE, COMPLETE ALL SECTIONS AS DESCRIBED.\r\nAlso test if the latest release, and devel branch are affected too.\r\nALWAYS add information AFTER (OUTSIDE) these html comments.\r\nOtherwise it may end up being automatically closed by our bot. -->\r\n\r\n##### SUMMARY\r\nThe file modules issues an warning when setting the state to 'absent ' for links.\r\nThis should be no warning when conditionally evaluating if a link should be created or removed.\r\n\r\n##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\n\"file\"\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste, BELOW THIS COMMENT, verbatim output from \"ansible --version\" between quotes below -->\r\n```\r\nansible 2.6.2\r\n  config file = /home/myself/ansible/server-config/ansible/ansible.cfg\r\n  configured module search path = [u'/home/myself/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /usr/lib/python2.7/dist-packages/ansible\r\n  executable location = /usr/bin/ansible\r\n  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]\r\n```\r\n\r\n##### CONFIGURATION\r\n<!--- If using Ansible 2.4 or above, paste, BELOW THIS COMMENT, the results of \"ansible-config dump --only-changed\"\r\nOtherwise, mention any settings you have changed/added/removed in ansible.cfg\r\n(or using the ANSIBLE_* environment variables).-->\r\nANSIBLE_NOCOWS(/home/myself/ansible/server-config/ansible/ansible.cfg) = True\r\nANSIBLE_SSH_ARGS(/home/myself/ansible/server-config/ansible/ansible.cfg) = -o ControlMaster=auto -o ControlPersist=60s -o IdentitiesOnly=yes\r\nDEFAULT_ASK_VAULT_PASS(/home/myself/ansible/server-config/ansible/ansible.cfg) = True\r\nDEFAULT_BECOME(/home/myself/ansible/server-config/ansible/ansible.cfg) = True\r\nDEFAULT_BECOME_METHOD(/home/myself/ansible/server-config/ansible/ansible.cfg) = sudo\r\nDEFAULT_FORKS(/home/myself/ansible/server-config/ansible/ansible.cfg) = 15\r\nDEFAULT_HOST_LIST(/home/myself/ansible/server-config/ansible/ansible.cfg) = [u'/home/myself/ansible/server-config/ansible/hosts']\r\nDEFAULT_PRIVATE_KEY_FILE(/home/myself/ansible/ws_misc/server-config/ansible/ansible.cfg) = /home/stefan/.ssh/id_ed25519\r\nDEFAULT_REMOTE_USER(/home/myself/ansible/server-config/ansible/ansible.cfg) = stefan\r\nRETRY_FILES_ENABLED(/home/myself/ansible/server-config/ansible/ansible.cfg) = False\r\n\r\n\r\n##### OS / ENVIRONMENT\r\n<!--- Mention, BELOW THIS COMMENT, 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\nAlso mention the specific version of what you are trying to control,\r\ne.g. if this is a network bug the version of firmware on the network device.-->\r\n\r\nHost from: Debian 9.5 / stretch (amd64)\r\nHost managed: Debian 9.5 / stretch (amd64)\r\n\r\n##### STEPS TO REPRODUCE\r\n<!--- For bugs, show exactly how to reproduce the problem, using a minimal test-case.\r\nFor new features, show how the feature would be used. -->\r\n\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\n- name: \"Link existing monit conf for OpenNTPD\"\r\n  file:\r\n    src: \"monit/openntpd\"\r\n    dest: \"/etc/monit/conf.d/openntpd\"\r\n    state: \"{{ 'link' if use_openntpd else 'absent' }}\"\r\n\r\n```\r\nThe example decides based on the boolean var \"use_openntpd\" if a link should be created or an old\r\nexisting link should be removed.\r\n\r\nThe warning is printed when state is evaluated to \"absent\" as this seems to be no valid state within this case. The state of absend should not produce a warning (or an error) \r\n\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\n\r\nThere should be no warning or error message for state \"absent\". \"absent\" should be a valid state\r\nwhen specifying a \"src\" attribute too for dynamic evaluation within one task.\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\r\n\r\nThe \"file\" module does some sanity checks if the \"src\" attribute is set and disallows all states except\r\n\"link\" and \"hard\". This check was introduced in https://github.com/ansible/ansible/commit/6227c2ac75acefbe30d3a22252adfc25ea52a3ae\r\n\"absent\" is currently no valid state, but should be IMHO.\r\n\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\nTASK [linux_base : Link existing monit conf for OpenNTPD] *********************************************************************************************\r\n [WARNING]: The src option requires state to be 'link' or 'hard'.  This will become an error in Ansible 2.10\r\n\r\nok: [127.0.0.1]\r\n```\r\n"}}
{"actor":{"display_login":"sseide"}}