<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">redhat_subscription</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
"><pre class="notranslate"><code class="notranslate">ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">RHEL 7.3</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">redhat_subscription manager is overloading the value type of the original subscription manager.  This causes confusion and over-consumption of entitlements.</p>
<p dir="auto">The official Red Hat Subscription Manager allows attaching subscriptions by Pool ID, NOT by Pool Name.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[root@rhel7 ~]# subscription-manager attach --help
Usage: subscription-manager attach [OPTIONS]

Attach a specified subscription to the registered system

Options:
  -h, --help            show this help message and exit
  --proxy=PROXY_URL     proxy URL in the form of proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword=PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --pool=POOL           the ID of the pool to attach (can be specified more
                        than once)
  --quantity=QUANTITY   number of subscriptions to attach
  --auto                Automatically attach compatible subscriptions to this
                        system. This is the default action.
  --servicelevel=SERVICE_LEVEL
                        service level to apply to this system
  --file=FILE           A file from which to read pool IDs. If a hyphen is
                        provided, pool IDs will be read from stdin.
[root@rhel7 ~]# "><pre class="notranslate"><code class="notranslate">[root@rhel7 ~]# subscription-manager attach --help
Usage: subscription-manager attach [OPTIONS]

Attach a specified subscription to the registered system

Options:
  -h, --help            show this help message and exit
  --proxy=PROXY_URL     proxy URL in the form of proxy_hostname:proxy_port
  --proxyuser=PROXY_USER
                        user for HTTP proxy with basic authentication
  --proxypassword=PROXY_PASSWORD
                        password for HTTP proxy with basic authentication
  --pool=POOL           the ID of the pool to attach (can be specified more
                        than once)
  --quantity=QUANTITY   number of subscriptions to attach
  --auto                Automatically attach compatible subscriptions to this
                        system. This is the default action.
  --servicelevel=SERVICE_LEVEL
                        service level to apply to this system
  --file=FILE           A file from which to read pool IDs. If a hyphen is
                        provided, pool IDs will be read from stdin.
[root@rhel7 ~]# 
</code></pre></div>
<p dir="auto">Because this module is allowing a user to specify a name and trying to do its own logic and parsing of available Pool IDs, it is incorrectly attempting to extend the capabilities of the official subscription manager.  It also does it poorly, allowing multiple subscriptions to be consumed when they were not desired.</p>
<p dir="auto">Large customers will have many duplicate subscriptions of the same name due to growth and purchases made at different times.  This could have a very large impact to large customers.</p>
<p dir="auto">The feature to enable using the Pool ID is a good start, but we also must remove the capability of adding by Name.  This Ansible module should not attempt to do more than the original tool allows.<br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="173998468" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/4603" data-hovercard-type="pull_request" data-hovercard-url="/ansible/ansible-modules-core/pull/4603/hovercard" href="https://github.com/ansible/ansible-modules-core/pull/4603">ansible/ansible-modules-core#4603</a></p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- redhat_subscription:
    state: present
    username: &quot;{{ rhn_username }}&quot;
    password: &quot;{{ rhn_password }}&quot;
    pool: '^Employee SKU$'
#    pool: &quot;{{ POOL_ID }}&quot;
  when: ansible_distribution == 'RedHat'"><pre class="notranslate">- <span class="pl-ent">redhat_subscription</span>:
    <span class="pl-ent">state</span>: <span class="pl-s">present</span>
    <span class="pl-ent">username</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ rhn_username }}<span class="pl-pds">"</span></span>
    <span class="pl-ent">password</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ rhn_password }}<span class="pl-pds">"</span></span>
    <span class="pl-ent">pool</span>: <span class="pl-s"><span class="pl-pds">'</span>^Employee SKU$<span class="pl-pds">'</span></span>
<span class="pl-c"><span class="pl-c">#</span>    pool: "{{ POOL_ID }}"</span>
  <span class="pl-ent">when</span>: <span class="pl-s">ansible_distribution == 'RedHat'</span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">Only a single Pool ID attached, presumably the first one matched.  But certainly not ALL matches.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">I have altered the values below to protect our actual Pool IDs (XXX, YYY, ZZZ).  I can provide actual examples privately.</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;util7vm&gt; SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -tt util7vm '/bin/sh -c '&quot;'&quot;'sudo -H -S -n -u root /bin/sh -c '&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'echo BECOME-SUCCESS-pyeuamdvwtzvyzuxvbczhjotjfyacqxn; /usr/bin/python /root/.ansible/tmp/ansible-tmp-1481978149.12-197063747409681/redhat_subscription.py; rm -rf &quot;/root/.ansible/tmp/ansible-tmp-1481978149.12-197063747409681/&quot; &gt; /dev/null 2&gt;&amp;1'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;'&quot;' &amp;&amp; sleep 0'&quot;'&quot;''
changed: [util7vm] =&gt; {
    &quot;changed&quot;: true, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;activationkey&quot;: null, 
            &quot;autosubscribe&quot;: false, 
            &quot;consumer_id&quot;: null, 
            &quot;consumer_name&quot;: null, 
            &quot;consumer_type&quot;: null, 
            &quot;environment&quot;: null, 
            &quot;force_register&quot;: false, 
            &quot;org_id&quot;: null, 
            &quot;password&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;, 
            &quot;pool&quot;: &quot;^Employee SKU$&quot;, 
            &quot;rhsm_baseurl&quot;: &quot;https://cdn.redhat.com&quot;, 
            &quot;server_hostname&quot;: &quot;subscription.rhn.redhat.com&quot;, 
            &quot;server_insecure&quot;: &quot;0&quot;, 
            &quot;state&quot;: &quot;present&quot;, 
            &quot;username&quot;: &quot;my-rhn-support-username&quot;
        }, 
        &quot;module_name&quot;: &quot;redhat_subscription&quot;
    }, 
    &quot;subscribed_pool_ids&quot;: [
        &quot;XXXXXXXXXXXXXXXXXXXXXXXXXXX&quot;,   
        &quot;YYYYYYYYYYYYYYYYYYYYYYYY&quot;, 
        &quot;ZZZZZZZZZZZZZZZZZZZZZZZZZZZ&quot;
    ], 
    &quot;unsubscribed_serials&quot;: []
}

PLAY RECAP *********************************************************************
util7vm                    : ok=2    changed=1    unreachable=0    failed=0   "><pre class="notranslate"><code class="notranslate">&lt;util7vm&gt; SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -tt util7vm '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-pyeuamdvwtzvyzuxvbczhjotjfyacqxn; /usr/bin/python /root/.ansible/tmp/ansible-tmp-1481978149.12-197063747409681/redhat_subscription.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1481978149.12-197063747409681/" &gt; /dev/null 2&gt;&amp;1'"'"'"'"'"'"'"'"' &amp;&amp; sleep 0'"'"''
changed: [util7vm] =&gt; {
    "changed": true, 
    "invocation": {
        "module_args": {
            "activationkey": null, 
            "autosubscribe": false, 
            "consumer_id": null, 
            "consumer_name": null, 
            "consumer_type": null, 
            "environment": null, 
            "force_register": false, 
            "org_id": null, 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "pool": "^Employee SKU$", 
            "rhsm_baseurl": "https://cdn.redhat.com", 
            "server_hostname": "subscription.rhn.redhat.com", 
            "server_insecure": "0", 
            "state": "present", 
            "username": "my-rhn-support-username"
        }, 
        "module_name": "redhat_subscription"
    }, 
    "subscribed_pool_ids": [
        "XXXXXXXXXXXXXXXXXXXXXXXXXXX",   
        "YYYYYYYYYYYYYYYYYYYYYYYY", 
        "ZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
    ], 
    "unsubscribed_serials": []
}

PLAY RECAP *********************************************************************
util7vm                    : ok=2    changed=1    unreachable=0    failed=0   
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">Module docker_network</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible --version
ansible 2.3.0.0
  config file = /Users/me/code/test_master/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]"><pre class="notranslate"><code class="notranslate">ansible --version
ansible 2.3.0.0
  config file = /Users/me/code/test_master/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[defaults]
force_color = 1
; force_handlers = True
host_key_checking = false
inventory = inventory
retry_files_enabled = false
any_errors_fatal = true
#roles_path = roles"><pre class="notranslate"><code class="notranslate">[defaults]
force_color = 1
; force_handlers = True
host_key_checking = false
inventory = inventory
retry_files_enabled = false
any_errors_fatal = true
#roles_path = roles
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Mac OS Sierra 10.1.2.4</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Using the overlay network driver with the docker module fails, however the bridge driver works successfully. Hence I have made a determination that the error is overlay driver specific.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: Managing Docker Swarm Networks
  docker_network:
    name:  test_net_overlay
    driver: overlay
    state: present"><pre class="notranslate"><code class="notranslate">- name: Managing Docker Swarm Networks
  docker_network:
    name:  test_net_overlay
    driver: overlay
    state: present
</code></pre></div>
<p dir="auto">Causes error below</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ok: [10.131.92.197] =&gt; (item={u'state': u'present', u'driver': u'bridge', u'name': u'test_net_bridge'}) =&gt; {&quot;ansible_facts&quot;: {}, &quot;changed&quot;: false, &quot;item&quot;: {&quot;driver&quot;: &quot;bridge&quot;, &quot;name&quot;: &quot;test_net_bridge&quot;, &quot;state&quot;: &quot;present&quot;}}

failed: [10.131.92.197] (item={u'state': u'present', u'driver': u'overlay', u'name': u'test_net_overlay'}) =&gt; {&quot;failed&quot;: true, &quot;item&quot;: {&quot;driver&quot;: &quot;overlay&quot;, &quot;name&quot;: &quot;test_net_overlay&quot;, &quot;state&quot;: &quot;present&quot;}, &quot;module_stderr&quot;: &quot;Shared connection to 10.131.92.197 closed.\r\n&quot;, &quot;module_stdout&quot;: &quot;Traceback (most recent call last):\r\n  File \&quot;/tmp/ansible_N_OU9h/ansible_module_docker_network.py\&quot;, line 393, in &lt;module&gt;\r\n    main()\r\n  File \&quot;/tmp/ansible_N_OU9h/ansible_module_docker_network.py\&quot;, line 386, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \&quot;/tmp/ansible_N_OU9h/ansible_module_docker_network.py\&quot;, line 215, in __init__\r\n    self.parameters.connected = container_names_in_network(self.existing_network)\r\n  File \&quot;/tmp/ansible_N_OU9h/ansible_module_docker_network.py\&quot;, line 197, in container_names_in_network\r\n    return [c['Name'] for c in network['Containers'].values()]\r\nAttributeError: 'NoneType' object has no attribute 'values'\r\n&quot;, &quot;msg&quot;: &quot;MODULE FAILURE&quot;, &quot;rc&quot;: 0}"><pre class="notranslate"><code class="notranslate">ok: [10.131.92.197] =&gt; (item={u'state': u'present', u'driver': u'bridge', u'name': u'test_net_bridge'}) =&gt; {"ansible_facts": {}, "changed": false, "item": {"driver": "bridge", "name": "test_net_bridge", "state": "present"}}

failed: [10.131.92.197] (item={u'state': u'present', u'driver': u'overlay', u'name': u'test_net_overlay'}) =&gt; {"failed": true, "item": {"driver": "overlay", "name": "test_net_overlay", "state": "present"}, "module_stderr": "Shared connection to 10.131.92.197 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_N_OU9h/ansible_module_docker_network.py\", line 393, in &lt;module&gt;\r\n    main()\r\n  File \"/tmp/ansible_N_OU9h/ansible_module_docker_network.py\", line 386, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \"/tmp/ansible_N_OU9h/ansible_module_docker_network.py\", line 215, in __init__\r\n    self.parameters.connected = container_names_in_network(self.existing_network)\r\n  File \"/tmp/ansible_N_OU9h/ansible_module_docker_network.py\", line 197, in container_names_in_network\r\n    return [c['Name'] for c in network['Containers'].values()]\r\nAttributeError: 'NoneType' object has no attribute 'values'\r\n", "msg": "MODULE FAILURE", "rc": 0}
</code></pre></div>
<blockquote>
<p dir="auto">Note: The bridge driver works correctly, but the overlay driver fails.</p>
</blockquote>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Module should not return an error</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">Module returned error</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="failed: [10.131.92.197] (item={u'state': u'present', u'driver': u'overlay', u'name': u'test_net_overlay'}) =&gt; {&quot;failed&quot;: true, &quot;item&quot;: {&quot;driver&quot;: &quot;overlay&quot;, &quot;name&quot;: &quot;test_net_overlay&quot;, &quot;state&quot;: &quot;present&quot;}, &quot;module_stderr&quot;: &quot;Shared connection to 10.131.92.197 closed.\r\n&quot;, &quot;module_stdout&quot;: &quot;Traceback (most recent call last):\r\n  File \&quot;/tmp/ansible_N_OU9h/ansible_module_docker_network.py\&quot;, line 393, in &lt;module&gt;\r\n    main()\r\n  File \&quot;/tmp/ansible_N_OU9h/ansible_module_docker_network.py\&quot;, line 386, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \&quot;/tmp/ansible_N_OU9h/ansible_module_docker_network.py\&quot;, line 215, in __init__\r\n    self.parameters.connected = container_names_in_network(self.existing_network)\r\n  File \&quot;/tmp/ansible_N_OU9h/ansible_module_docker_network.py\&quot;, line 197, in container_names_in_network\r\n    return [c['Name'] for c in network['Containers'].values()]\r\nAttributeError: 'NoneType' object has no attribute 'values'\r\n&quot;, &quot;msg&quot;: &quot;MODULE FAILURE&quot;, &quot;rc&quot;: 0}"><pre class="notranslate"><code class="notranslate">failed: [10.131.92.197] (item={u'state': u'present', u'driver': u'overlay', u'name': u'test_net_overlay'}) =&gt; {"failed": true, "item": {"driver": "overlay", "name": "test_net_overlay", "state": "present"}, "module_stderr": "Shared connection to 10.131.92.197 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_N_OU9h/ansible_module_docker_network.py\", line 393, in &lt;module&gt;\r\n    main()\r\n  File \"/tmp/ansible_N_OU9h/ansible_module_docker_network.py\", line 386, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \"/tmp/ansible_N_OU9h/ansible_module_docker_network.py\", line 215, in __init__\r\n    self.parameters.connected = container_names_in_network(self.existing_network)\r\n  File \"/tmp/ansible_N_OU9h/ansible_module_docker_network.py\", line 197, in container_names_in_network\r\n    return [c['Name'] for c in network['Containers'].values()]\r\nAttributeError: 'NoneType' object has no attribute 'values'\r\n", "msg": "MODULE FAILURE", "rc": 0}
</code></pre></div>