<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">NA</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook 2.5.0 (devel 91e9aaca28) last updated 2017/10/18 17:12:24 (GMT +100)
  config file = 
  configured module search path = [u'/Users/lynchg/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/lynchg/git/github.com/ansible/ansible/lib/ansible
  executable location = /Users/lynchg/git/github.com/ansible/ansible/bin/ansible-playbook
  python version = 2.7.13 (default, Dec 18 2016, 07:03:34) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]"><pre class="notranslate"><code class="notranslate">ansible-playbook 2.5.0 (devel 91e9aaca28) last updated 2017/10/18 17:12:24 (GMT +100)
  config file = 
  configured module search path = [u'/Users/lynchg/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/lynchg/git/github.com/ansible/ansible/lib/ansible
  executable location = /Users/lynchg/git/github.com/ansible/ansible/bin/ansible-playbook
  python version = 2.7.13 (default, Dec 18 2016, 07:03:34) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">NA</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">NA</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">It appears that ansible falls back to its 'default' <code class="notranslate">shell</code> module when a module or action plugin can't be found.  Which can lead to a very confusing error message.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">write a custom module and action plugin that generates custom facts</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# library/eos_custom_facts.py
# emtpy file"><pre class="notranslate"><span class="pl-c"># library/eos_custom_facts.py</span>
<span class="pl-c"># emtpy file</span></pre></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# plugins/action/eos_custom_facts.py
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import re
import netaddr

from ansible.errors import AnsibleError
from ansible.plugins.action import ActionBase

class ActionModule(ActionBase):
    def run(self, tmp=None, task_vars=None):
        ''' handler for eos_custom_facts operations '''

        if task_vars is None:
            task_vars = dict()

        result = super(ActionModule, self).run(tmp, task_vars)

        results = {}

        result['ansible_facts'] = results

        return result"><pre class="notranslate"><span class="pl-c"># plugins/action/eos_custom_facts.py</span>
<span class="pl-k">from</span> __future__ <span class="pl-k">import</span> (<span class="pl-s1">absolute_import</span>, <span class="pl-s1">division</span>, <span class="pl-s1">print_function</span>)
<span class="pl-s1">__metaclass__</span> <span class="pl-c1">=</span> <span class="pl-s1">type</span>

<span class="pl-k">import</span> <span class="pl-s1">re</span>
<span class="pl-k">import</span> <span class="pl-s1">netaddr</span>

<span class="pl-k">from</span> <span class="pl-s1">ansible</span>.<span class="pl-s1">errors</span> <span class="pl-k">import</span> <span class="pl-v">AnsibleError</span>
<span class="pl-k">from</span> <span class="pl-s1">ansible</span>.<span class="pl-s1">plugins</span>.<span class="pl-s1">action</span> <span class="pl-k">import</span> <span class="pl-v">ActionBase</span>

<span class="pl-k">class</span> <span class="pl-v">ActionModule</span>(<span class="pl-v">ActionBase</span>):
    <span class="pl-k">def</span> <span class="pl-en">run</span>(<span class="pl-s1">self</span>, <span class="pl-s1">tmp</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-s1">task_vars</span><span class="pl-c1">=</span><span class="pl-c1">None</span>):
        <span class="pl-s">''' handler for eos_custom_facts operations '''</span>

        <span class="pl-k">if</span> <span class="pl-s1">task_vars</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span>:
            <span class="pl-s1">task_vars</span> <span class="pl-c1">=</span> <span class="pl-en">dict</span>()

        <span class="pl-s1">result</span> <span class="pl-c1">=</span> <span class="pl-en">super</span>(<span class="pl-v">ActionModule</span>, <span class="pl-s1">self</span>).<span class="pl-en">run</span>(<span class="pl-s1">tmp</span>, <span class="pl-s1">task_vars</span>)

        <span class="pl-s1">results</span> <span class="pl-c1">=</span> {}

        <span class="pl-s1">result</span>[<span class="pl-s">'ansible_facts'</span>] <span class="pl-c1">=</span> <span class="pl-s1">results</span>

        <span class="pl-k">return</span> <span class="pl-s1">result</span></pre></div>
<p dir="auto">forget to add the action plugin path</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible all -i hosts -m eos_custom_facts"><pre class="notranslate"><code class="notranslate">ansible all -i hosts -m eos_custom_facts
</code></pre></div>
<p dir="auto">or mistype the module name</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible all -i hosts -m eos_custom_fact"><pre class="notranslate"><code class="notranslate">ansible all -i hosts -m eos_custom_fact
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">An error stating the module/plugin couldn't be found</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="SWITCHNAME | FAILED! =&gt; {
    &quot;changed&quot;: false,
    &quot;msg&quot;: &quot;unable to open shell. Please see: https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell&quot;
}"><pre class="notranslate"><code class="notranslate">SWITCHNAME | FAILED! =&gt; {
    "changed": false,
    "msg": "unable to open shell. Please see: https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell"
}
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">modules/windows/win_firewall_rule</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.1.0
  config file = /Users/cg/Repo/ansible-windows-examples/ansible.cfg
  configured module search path = ['/Users/cg/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/cg/anaconda3/lib/python3.6/site-packages/ansible
  executable location = /Users/cg/anaconda3/bin/ansible
  python version = 3.6.3 |Anaconda, Inc.| (default, Oct  6 2017, 12:04:38) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.1.0
  config file = /Users/cg/Repo/ansible-windows-examples/ansible.cfg
  configured module search path = ['/Users/cg/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/cg/anaconda3/lib/python3.6/site-packages/ansible
  executable location = /Users/cg/anaconda3/bin/ansible
  python version = 3.6.3 |Anaconda, Inc.| (default, Oct  6 2017, 12:04:38) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="DEFAULT_HOST_LIST(/Users/cg/Repo/ansible-windows-examples/ansible.cfg) = ['/Users/cg/Repo/ansible-windows-examples/inventory.yml']
HOST_KEY_CHECKING(/Users/cg/Repo/ansible-windows-examples/ansible.cfg) = False"><pre class="notranslate"><code class="notranslate">DEFAULT_HOST_LIST(/Users/cg/Repo/ansible-windows-examples/ansible.cfg) = ['/Users/cg/Repo/ansible-windows-examples/inventory.yml']
HOST_KEY_CHECKING(/Users/cg/Repo/ansible-windows-examples/ansible.cfg) = False
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Control system: MacOS 10.12.6<br>
Target system: Windows 2012 Server R2 server guest deployed on Virtualbox 5.1</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">The win_firewall module accepts a Name parameter that is used to check for and create Windows Firewall rules with the same DisplayName rather than Name property of the Get-NetFirewallRule PowerShell command.<br>
This creates the inability to distinguish and select a firewall rule with a different Name but same DisplayName.</p>
<p dir="auto">For examples, the built-in firewall rules with the DisplayName "Remote Desktop - User Mode (TCP-In)" have two distinct Name properties:</p>
<ul dir="auto">
<li>RemoteDesktop-UserMode-In-TCP</li>
<li>RemoteDesktop-UserMode-In-UDP</li>
</ul>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">The properties can be verified with this example by running the following on the PowerShell command line.<br>
Also, when the Name property returned from PowerShell is used as the Name property of the module a new firewall rule is created with the same DisplayName.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Get-NetFirewallRule -DisplayName &quot;Remote Desktop - User Mode*&quot;"><pre class="notranslate"><code class="notranslate">Get-NetFirewallRule -DisplayName "Remote Desktop - User Mode*"
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">The ability to select a firewall rule based on either Name or DisplayName<br>
The module Name property is mapped to the <code class="notranslate">Get-NetFirewallRule -Name</code> and a new DisplayName is added and mapped to the <code class="notranslate">Get-NetFirewallRule -DisplayName</code> property.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="The module name field is mapped to the Get-NetFirewallRule -DisplayName "><pre class="notranslate"><code class="notranslate">The module name field is mapped to the Get-NetFirewallRule -DisplayName 
</code></pre></div>