<p dir="auto">From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/guenhter/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/guenhter">@guenhter</a> on 2016-10-13T15:58:27Z</p>

<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">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 2.2.0.0 (detached HEAD 44faad0593) last updated 2016/10/13 13:41:31 (GMT +000)
  lib/ansible/modules/core: (detached HEAD d66983b43e) last updated 2016/10/13 13:41:31 (GMT +000)
  lib/ansible/modules/extras: (detached HEAD 35132b892f) last updated 2016/10/13 13:41:31 (GMT +000)
  config file =
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.2.0.0 (detached HEAD 44faad0593) last updated 2016/10/13 13:41:31 (GMT +000)
  lib/ansible/modules/core: (detached HEAD d66983b43e) last updated 2016/10/13 13:41:31 (GMT +000)
  lib/ansible/modules/extras: (detached HEAD 35132b892f) last updated 2016/10/13 13:41:31 (GMT +000)
  config file =
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">no changes in environment</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Debian 8.6<br>
Linux machine0 3.16.0-4-amd64 <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3525390" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/1" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/1/hovercard" href="https://github.com/ansible/ansible/issues/1">#1</a> SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Docker network can't be created with driver <code class="notranslate">overlay</code>.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<ol dir="auto">
<li>Setup docker in swarm mode (e.g. with <a href="https://github.com/atosatto/ansible-dockerswarm">https://github.com/atosatto/ansible-dockerswarm</a>)</li>
<li>Just execute this task in a environment where docker 1.12.1 runs in swarm mode.</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: Sample network
  docker_network:
    name: my-net1
    driver: overlay"><pre class="notranslate"><code class="notranslate">- name: Sample network
  docker_network:
    name: my-net1
    driver: overlay
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">New network is created</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">Runtime error when playbook is executed and task is reached</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [ansible-dockerswarm : Sample network] ************************************
task path: /vagrant/service-playbooks/roles/ansible-dockerswarm/tasks/swarm_cluster.yml:15
Using module file /home/vagrant/ansible/lib/ansible/modules/core/cloud/docker/docker_network.py
&lt;192.168.77.202&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.202&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.202 '/bin/sh -c '&quot;'&quot;'( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759 `&quot; &amp;&amp; echo ansible-tmp-1476374253.85-52715585730759=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759 `&quot; ) &amp;&amp; sleep 0'&quot;'&quot;''
Using module file /home/vagrant/ansible/lib/ansible/modules/core/cloud/docker/docker_network.py
&lt;192.168.77.203&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.203&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.203 '/bin/sh -c '&quot;'&quot;'( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119 `&quot; &amp;&amp; echo ansible-tmp-1476374253.86-156181693682119=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119 `&quot; ) &amp;&amp; sleep 0'&quot;'&quot;''
Using module file /home/vagrant/ansible/lib/ansible/modules/core/cloud/docker/docker_network.py
&lt;192.168.77.201&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.201&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.201 '/bin/sh -c '&quot;'&quot;'( umask 77 &amp;&amp; mkdir -p &quot;` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690 `&quot; &amp;&amp; echo ansible-tmp-1476374253.86-87520848410690=&quot;` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690 `&quot; ) &amp;&amp; sleep 0'&quot;'&quot;''
&lt;192.168.77.203&gt; PUT /tmp/tmpHAeuPH TO /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/docker_network.py
&lt;192.168.77.203&gt; SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.77.203]'
&lt;192.168.77.202&gt; PUT /tmp/tmptFUA_b TO /home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/docker_network.py
&lt;192.168.77.202&gt; SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.77.202]'
&lt;192.168.77.201&gt; PUT /tmp/tmpDZd6Bx TO /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/docker_network.py
&lt;192.168.77.201&gt; SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.77.201]'
&lt;192.168.77.203&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.203&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.203 '/bin/sh -c '&quot;'&quot;'chmod u+x /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/ /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/docker_network.py &amp;&amp; sleep 0'&quot;'&quot;''
&lt;192.168.77.202&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.202&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.202 '/bin/sh -c '&quot;'&quot;'chmod u+x /home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/ /home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/docker_network.py &amp;&amp; sleep 0'&quot;'&quot;''
&lt;192.168.77.201&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.201&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.201 '/bin/sh -c '&quot;'&quot;'chmod u+x /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/ /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/docker_network.py &amp;&amp; sleep 0'&quot;'&quot;''
&lt;192.168.77.203&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.201&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.201&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.77.201 '/bin/sh -c '&quot;'&quot;'/usr/bin/python /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/docker_network.py; rm -rf &quot;/home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'&quot;'&quot;''
&lt;192.168.77.202&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.202&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.77.202 '/bin/sh -c '&quot;'&quot;'/usr/bin/python /home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/docker_network.py; rm -rf &quot;/home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'&quot;'&quot;''
&lt;192.168.77.203&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.77.203 '/bin/sh -c '&quot;'&quot;'/usr/bin/python /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/docker_network.py; rm -rf &quot;/home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'&quot;'&quot;''
fatal: [machine_3]: FAILED! =&gt; {
    &quot;changed&quot;: false,
    &quot;failed&quot;: true,
    &quot;invocation&quot;: {
        &quot;module_name&quot;: &quot;docker_network&quot;
    },
    &quot;module_stderr&quot;: &quot;OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 10854\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 192.168.77.203 closed.\r\n&quot;,
    &quot;module_stdout&quot;: &quot;Traceback (most recent call last):\r\n  File \&quot;/tmp/ansible_UmI8My/ansible_module_docker_network.py\&quot;, line 378, in &lt;module&gt;\r\n    main()\r\n  File \&quot;/tmp/ansible_UmI8My/ansible_module_docker_network.py\&quot;, line 371, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \&quot;/tmp/ansible_UmI8My/ansible_module_docker_network.py\&quot;, line 211, in __init__\r\n    self.present()\r\n  File \&quot;/tmp/ansible_UmI8My/ansible_module_docker_network.py\&quot;, line 335, in present\r\n    self.create_network()\r\n  File \&quot;/tmp/ansible_UmI8My/ansible_module_docker_network.py\&quot;, line 283, in create_network\r\n    ipam=ipam_config)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py\&quot;, line 35, in wrapper\r\n    return f(self, *args, **kwargs)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/api/network.py\&quot;, line 62, in create_network\r\n    return self._result(res, json=True)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/client.py\&quot;, line 178, in _result\r\n    self._raise_for_status(response)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/client.py\&quot;, line 174, in _raise_for_status\r\n    raise errors.APIError(e, response, explanation=explanation)\r\ndocker.errors.APIError: 500 Server Error: Internal Server Error (\&quot;{\&quot;message\&quot;:\&quot;datastore for scope \\\&quot;global\\\&quot; is not initialized \&quot;}\&quot;)\r\n&quot;,
    &quot;msg&quot;: &quot;MODULE FAILURE&quot;
}
fatal: [machine_2]: FAILED! =&gt; {
    &quot;changed&quot;: false,
    &quot;failed&quot;: true,
    &quot;invocation&quot;: {
        &quot;module_name&quot;: &quot;docker_network&quot;
    },
    &quot;module_stderr&quot;: &quot;OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 10849\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 192.168.77.202 closed.\r\n&quot;,
    &quot;module_stdout&quot;: &quot;Traceback (most recent call last):\r\n  File \&quot;/tmp/ansible_gJEa7t/ansible_module_docker_network.py\&quot;, line 378, in &lt;module&gt;\r\n    main()\r\n  File \&quot;/tmp/ansible_gJEa7t/ansible_module_docker_network.py\&quot;, line 371, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \&quot;/tmp/ansible_gJEa7t/ansible_module_docker_network.py\&quot;, line 211, in __init__\r\n    self.present()\r\n  File \&quot;/tmp/ansible_gJEa7t/ansible_module_docker_network.py\&quot;, line 335, in present\r\n    self.create_network()\r\n  File \&quot;/tmp/ansible_gJEa7t/ansible_module_docker_network.py\&quot;, line 283, in create_network\r\n    ipam=ipam_config)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py\&quot;, line 35, in wrapper\r\n    return f(self, *args, **kwargs)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/api/network.py\&quot;, line 62, in create_network\r\n    return self._result(res, json=True)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/client.py\&quot;, line 178, in _result\r\n    self._raise_for_status(response)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/client.py\&quot;, line 174, in _raise_for_status\r\n    raise errors.APIError(e, response, explanation=explanation)\r\ndocker.errors.APIError: 500 Server Error: Internal Server Error (\&quot;{\&quot;message\&quot;:\&quot;datastore for scope \\\&quot;global\\\&quot; is not initialized \&quot;}\&quot;)\r\n&quot;,
    &quot;msg&quot;: &quot;MODULE FAILURE&quot;
}
fatal: [machine_1]: FAILED! =&gt; {
    &quot;changed&quot;: false,
    &quot;failed&quot;: true,
    &quot;invocation&quot;: {
        &quot;module_name&quot;: &quot;docker_network&quot;
    },
    &quot;module_stderr&quot;: &quot;OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 10754\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 192.168.77.201 closed.\r\n&quot;,
    &quot;module_stdout&quot;: &quot;Traceback (most recent call last):\r\n  File \&quot;/tmp/ansible_kgQpcW/ansible_module_docker_network.py\&quot;, line 378, in &lt;module&gt;\r\n    main()\r\n  File \&quot;/tmp/ansible_kgQpcW/ansible_module_docker_network.py\&quot;, line 371, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \&quot;/tmp/ansible_kgQpcW/ansible_module_docker_network.py\&quot;, line 211, in __init__\r\n    self.present()\r\n  File \&quot;/tmp/ansible_kgQpcW/ansible_module_docker_network.py\&quot;, line 335, in present\r\n    self.create_network()\r\n  File \&quot;/tmp/ansible_kgQpcW/ansible_module_docker_network.py\&quot;, line 283, in create_network\r\n    ipam=ipam_config)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py\&quot;, line 35, in wrapper\r\n    return f(self, *args, **kwargs)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/api/network.py\&quot;, line 62, in create_network\r\n    return self._result(res, json=True)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/client.py\&quot;, line 178, in _result\r\n    self._raise_for_status(response)\r\n  File \&quot;/usr/local/lib/python2.7/dist-packages/docker/client.py\&quot;, line 174, in _raise_for_status\r\n    raise errors.APIError(e, response, explanation=explanation)\r\ndocker.errors.APIError: 500 Server Error: Internal Server Error (\&quot;{\&quot;message\&quot;:\&quot;rpc error: code = 3 desc = driver name: if driver is specified name is required\&quot;}\&quot;)\r\n&quot;,
    &quot;msg&quot;: &quot;MODULE FAILURE&quot;
}"><pre class="notranslate"><code class="notranslate">TASK [ansible-dockerswarm : Sample network] ************************************
task path: /vagrant/service-playbooks/roles/ansible-dockerswarm/tasks/swarm_cluster.yml:15
Using module file /home/vagrant/ansible/lib/ansible/modules/core/cloud/docker/docker_network.py
&lt;192.168.77.202&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.202&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.202 '/bin/sh -c '"'"'( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759 `" &amp;&amp; echo ansible-tmp-1476374253.85-52715585730759="` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759 `" ) &amp;&amp; sleep 0'"'"''
Using module file /home/vagrant/ansible/lib/ansible/modules/core/cloud/docker/docker_network.py
&lt;192.168.77.203&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.203&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.203 '/bin/sh -c '"'"'( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119 `" &amp;&amp; echo ansible-tmp-1476374253.86-156181693682119="` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119 `" ) &amp;&amp; sleep 0'"'"''
Using module file /home/vagrant/ansible/lib/ansible/modules/core/cloud/docker/docker_network.py
&lt;192.168.77.201&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.201&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.201 '/bin/sh -c '"'"'( umask 77 &amp;&amp; mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690 `" &amp;&amp; echo ansible-tmp-1476374253.86-87520848410690="` echo $HOME/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690 `" ) &amp;&amp; sleep 0'"'"''
&lt;192.168.77.203&gt; PUT /tmp/tmpHAeuPH TO /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/docker_network.py
&lt;192.168.77.203&gt; SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.77.203]'
&lt;192.168.77.202&gt; PUT /tmp/tmptFUA_b TO /home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/docker_network.py
&lt;192.168.77.202&gt; SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.77.202]'
&lt;192.168.77.201&gt; PUT /tmp/tmpDZd6Bx TO /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/docker_network.py
&lt;192.168.77.201&gt; SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.77.201]'
&lt;192.168.77.203&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.203&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.203 '/bin/sh -c '"'"'chmod u+x /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/ /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/docker_network.py &amp;&amp; sleep 0'"'"''
&lt;192.168.77.202&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.202&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.202 '/bin/sh -c '"'"'chmod u+x /home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/ /home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/docker_network.py &amp;&amp; sleep 0'"'"''
&lt;192.168.77.201&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.201&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.201 '/bin/sh -c '"'"'chmod u+x /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/ /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/docker_network.py &amp;&amp; sleep 0'"'"''
&lt;192.168.77.203&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.201&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.201&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.77.201 '/bin/sh -c '"'"'/usr/bin/python /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/docker_network.py; rm -rf "/home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-87520848410690/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'"'"''
&lt;192.168.77.202&gt; ESTABLISH SSH CONNECTION FOR USER: deploy
&lt;192.168.77.202&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.77.202 '/bin/sh -c '"'"'/usr/bin/python /home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/docker_network.py; rm -rf "/home/deploy/.ansible/tmp/ansible-tmp-1476374253.85-52715585730759/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'"'"''
&lt;192.168.77.203&gt; SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.77.203 '/bin/sh -c '"'"'/usr/bin/python /home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/docker_network.py; rm -rf "/home/deploy/.ansible/tmp/ansible-tmp-1476374253.86-156181693682119/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'"'"''
fatal: [machine_3]: FAILED! =&gt; {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_name": "docker_network"
    },
    "module_stderr": "OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 10854\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 192.168.77.203 closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_UmI8My/ansible_module_docker_network.py\", line 378, in &lt;module&gt;\r\n    main()\r\n  File \"/tmp/ansible_UmI8My/ansible_module_docker_network.py\", line 371, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \"/tmp/ansible_UmI8My/ansible_module_docker_network.py\", line 211, in __init__\r\n    self.present()\r\n  File \"/tmp/ansible_UmI8My/ansible_module_docker_network.py\", line 335, in present\r\n    self.create_network()\r\n  File \"/tmp/ansible_UmI8My/ansible_module_docker_network.py\", line 283, in create_network\r\n    ipam=ipam_config)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py\", line 35, in wrapper\r\n    return f(self, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/api/network.py\", line 62, in create_network\r\n    return self._result(res, json=True)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/client.py\", line 178, in _result\r\n    self._raise_for_status(response)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/client.py\", line 174, in _raise_for_status\r\n    raise errors.APIError(e, response, explanation=explanation)\r\ndocker.errors.APIError: 500 Server Error: Internal Server Error (\"{\"message\":\"datastore for scope \\\"global\\\" is not initialized \"}\")\r\n",
    "msg": "MODULE FAILURE"
}
fatal: [machine_2]: FAILED! =&gt; {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_name": "docker_network"
    },
    "module_stderr": "OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 10849\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 192.168.77.202 closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_gJEa7t/ansible_module_docker_network.py\", line 378, in &lt;module&gt;\r\n    main()\r\n  File \"/tmp/ansible_gJEa7t/ansible_module_docker_network.py\", line 371, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \"/tmp/ansible_gJEa7t/ansible_module_docker_network.py\", line 211, in __init__\r\n    self.present()\r\n  File \"/tmp/ansible_gJEa7t/ansible_module_docker_network.py\", line 335, in present\r\n    self.create_network()\r\n  File \"/tmp/ansible_gJEa7t/ansible_module_docker_network.py\", line 283, in create_network\r\n    ipam=ipam_config)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py\", line 35, in wrapper\r\n    return f(self, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/api/network.py\", line 62, in create_network\r\n    return self._result(res, json=True)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/client.py\", line 178, in _result\r\n    self._raise_for_status(response)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/client.py\", line 174, in _raise_for_status\r\n    raise errors.APIError(e, response, explanation=explanation)\r\ndocker.errors.APIError: 500 Server Error: Internal Server Error (\"{\"message\":\"datastore for scope \\\"global\\\" is not initialized \"}\")\r\n",
    "msg": "MODULE FAILURE"
}
fatal: [machine_1]: FAILED! =&gt; {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_name": "docker_network"
    },
    "module_stderr": "OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 10754\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 192.168.77.201 closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_kgQpcW/ansible_module_docker_network.py\", line 378, in &lt;module&gt;\r\n    main()\r\n  File \"/tmp/ansible_kgQpcW/ansible_module_docker_network.py\", line 371, in main\r\n    cm = DockerNetworkManager(client)\r\n  File \"/tmp/ansible_kgQpcW/ansible_module_docker_network.py\", line 211, in __init__\r\n    self.present()\r\n  File \"/tmp/ansible_kgQpcW/ansible_module_docker_network.py\", line 335, in present\r\n    self.create_network()\r\n  File \"/tmp/ansible_kgQpcW/ansible_module_docker_network.py\", line 283, in create_network\r\n    ipam=ipam_config)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py\", line 35, in wrapper\r\n    return f(self, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/api/network.py\", line 62, in create_network\r\n    return self._result(res, json=True)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/client.py\", line 178, in _result\r\n    self._raise_for_status(response)\r\n  File \"/usr/local/lib/python2.7/dist-packages/docker/client.py\", line 174, in _raise_for_status\r\n    raise errors.APIError(e, response, explanation=explanation)\r\ndocker.errors.APIError: 500 Server Error: Internal Server Error (\"{\"message\":\"rpc error: code = 3 desc = driver name: if driver is specified name is required\"}\")\r\n",
    "msg": "MODULE FAILURE"
}
</code></pre></div>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="182830446" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/5254" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/5254/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/5254">ansible/ansible-modules-core#5254</a></p>
<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.0.1.0
  config file = /Users/do3cc/dev/ansible/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.0.1.0
  config file = /Users/do3cc/dev/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">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">It would be nice to be able to provide a seed for random, so that I get a predictible random number<br>
Use case:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: Periodic restart of workers
  cron:
    name: &quot;restart worker {{item}}&quot;
    minute: &quot;{{60|random(item)}}&quot;
    hour: */4
    job: &quot;restart {{item}}&quot;
"><pre class="notranslate"><code class="notranslate">- name: Periodic restart of workers
  cron:
    name: "restart worker {{item}}"
    minute: "{{60|random(item)}}"
    hour: */4
    job: "restart {{item}}"

</code></pre></div>
<p dir="auto">Given that the item name does not change with each invocation, I would always get the same random number, and my cronjob would not be changed with each invocation.</p>