{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2036","repository_url":"https://api.github.com/repos/ansible/ansible-modules-extras","labels_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2036/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2036/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2036/events","html_url":"https://github.com/ansible/ansible-modules-extras/issues/2036","id":148493253,"number":2036,"title":"win_firewall_rule: default profile 'current' not valid ","user":{"login":"one1zero1one","id":724604,"avatar_url":"https://avatars.githubusercontent.com/u/724604?v=3","gravatar_id":"","url":"https://api.github.com/users/one1zero1one","html_url":"https://github.com/one1zero1one","followers_url":"https://api.github.com/users/one1zero1one/followers","following_url":"https://api.github.com/users/one1zero1one/following{/other_user}","gists_url":"https://api.github.com/users/one1zero1one/gists{/gist_id}","starred_url":"https://api.github.com/users/one1zero1one/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/one1zero1one/subscriptions","organizations_url":"https://api.github.com/users/one1zero1one/orgs","repos_url":"https://api.github.com/users/one1zero1one/repos","events_url":"https://api.github.com/users/one1zero1one/events{/privacy}","received_events_url":"https://api.github.com/users/one1zero1one/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/labels/windows","name":"windows","color":"777777"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-04-14T21:54:45Z","updated_at":"2016-06-24T15:26:49Z","closed_at":null,"body":"##### 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/module/task -->\r\nwin_firewall_rule\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.1.0 (devel cb7b3b489d) last updated 2016/03/30 15:14:21 (GMT +200)\r\n  lib/ansible/modules/core: (detached HEAD 0268864211) last updated 2016/03/30 15:14:39 (GMT +200)\r\n  lib/ansible/modules/extras: (detached HEAD 6978984244) last updated 2016/03/30 15:14:39 (GMT +200)\r\n```\r\n\r\n##### CONFIGURATION\r\n<!---\r\n-->\r\n\r\n##### OS / ENVIRONMENT\r\n\r\nUbuntu 14.4 -> Windows 2012 R2 (Microsoft Windows [Version 6.3.9600])\r\n\r\n##### SUMMARY\r\n<!--- Explain the problem briefly -->\r\n\r\n[Example](http://docs.ansible.com/ansible/win_firewall_rule_module.html#examples) doesn't work. Returns \"changed\": true, but rule is not created. \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\n\r\n```\r\n- name: Firewall rule to allow smtp on TCP port 25\r\n  action: win_firewall_rule\r\n  args:\r\n      name: smtp\r\n      enable: yes\r\n      state: present\r\n      localport: 25\r\n      action: allow\r\n      direction: In\r\n      protocol: TCP\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\n\r\nFirewall Rule to be added.\r\n\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with high verbosity (-vvvv) -->\r\n\r\n`changed: [xxxxxxx] => {\"changed\": true, \"difference\": [], \"failed\": false, \"fwsettings\": {\"Action\": \"allow\", \"Direction\": \"In\", \"Enabled\": \"yes\", \"LocalPort\": 25, \"Profiles\": \"current\", \"Protocol\": \"TCP\", \"Rule Name\": \"smtp\"}, \"invocation\": {\"module_name\": \"win_firewall_rule\"}, \"msg\": [\"No rule could be found\", \"netsh advfirewall firewall add rule action=\\\"allow\\\" enable=\\\"yes\\\" dir=\\\"In\\\" name=\\\"smtp\\\" profile=\\\"current\\\" protocol=\\\"TCP\\\" localport=\\\"25\\\"\", \"Created firewall rule smtp\"]}`\r\n\r\nHowever, on the windows box the rule is **not** added - and when running the above in cmd returns\r\n\r\n```\r\nC:\\Users\\xxxxxxx>netsh advfirewall firewall add rule action=\\\"allow\\\" enable=\\\"yes\\\" dir=\\\"In\\\" \r\nname=\\\"smtp\\\" profile=\\\"current\\\" protocol=\\\"TCP\\\" localport=\\\"25\\\"\r\n\r\nOne or more of the specified profiles is  not valid. 'Any' cannot be specified\r\n if other profiles are specified.\r\n\r\n```\r\n\r\nDirty fix was to comment out  $fwsettings.Add(\"Profiles\", $winprofile).  \r\nExcluding profiles alltoghether was the only way to add/remove rules that have profile \"All\" in GUI, and return to the idempotent behaviour of the module.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/comments/228376494","html_url":"https://github.com/ansible/ansible-modules-extras/issues/2036#issuecomment-228376494","issue_url":"https://api.github.com/repos/ansible/ansible-modules-extras/issues/2036","id":228376494,"user":{"login":"taylorreece","id":3622586,"avatar_url":"https://avatars.githubusercontent.com/u/3622586?v=3","gravatar_id":"","url":"https://api.github.com/users/taylorreece","html_url":"https://github.com/taylorreece","followers_url":"https://api.github.com/users/taylorreece/followers","following_url":"https://api.github.com/users/taylorreece/following{/other_user}","gists_url":"https://api.github.com/users/taylorreece/gists{/gist_id}","starred_url":"https://api.github.com/users/taylorreece/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taylorreece/subscriptions","organizations_url":"https://api.github.com/users/taylorreece/orgs","repos_url":"https://api.github.com/users/taylorreece/repos","events_url":"https://api.github.com/users/taylorreece/events{/privacy}","received_events_url":"https://api.github.com/users/taylorreece/received_events","type":"User","site_admin":false},"created_at":"2016-06-24T15:26:49Z","updated_at":"2016-06-24T15:26:49Z","body":"@one1zero1one thank you for your recommendation.  That didn't work for me, but I figured out (after adding some debug output to win_firewall_rule.ps1) that on Windows 7 Pro, 'protocol' is required.  In these two examples, 'TaylorTest' fails, but 'TaylorTest2' is created successfully, despite the module claiming that both are created successfully.\r\n`netsh advfirewall firewall add rule localport=\"5000\" dir=\"in\" name=\"TaylorTest\" action=\"allow\"`\r\n`netsh advfirewall firewall add rule localport=\"5001\" protocol=\"TCP\" dir=\"in\" name=\"TaylorTest2\" action=\"allow\"`"}}
{"actor":{"display_login":"taylorreece"}}