<p dir="auto">From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/alexlist/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/alexlist">@alexlist</a> on 2016-04-22T03:27:34Z<br>
I didn't find exactly this problem reported, only other bug reports related to nfs mounts.</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">mount module</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.1.0
  config file = /home/alex/repos/infra/ansible/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.1.0
  config file = /home/alex/repos/infra/ansible/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">Standard.</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">CentOS 7 -&gt; CentOS 7<br>
Ubunt 15.10/16.04 -&gt; CentOS 7<br>
CentOS 7 -&gt; Ubuntu 15.10/16.04</p>
<p dir="auto">In this particular case, only CentOS 7 -&gt; CentOS 7</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">NFS mount point with state=mounted triggers error if already mounted.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Put a NFS mount stanza in a playbook and run the playbook when the mount is already mounted:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: configure fstab for alpha
  action: mount name=/srv/foo/alpha src=fileserver:/mdarchive/alpha fstype=nfs4 opts=rw,hard,tcp,intr,nolock,rsize=1048576,wsize=1048576,_netdev state=mounted"><pre class="notranslate"><code class="notranslate">- name: configure fstab for alpha
  action: mount name=/srv/foo/alpha src=fileserver:/mdarchive/alpha fstype=nfs4 opts=rw,hard,tcp,intr,nolock,rsize=1048576,wsize=1048576,_netdev state=mounted
</code></pre></div>
<p dir="auto">Run the playbook, get an error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [configure fstab for alpha] ***********************************************
fatal: [cluster-node01]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;msg&quot;: &quot;Error mounting /srv/foo/alpha: mount.nfs4: /srv/foo/alpha is busy or already mounted\n&quot;}"><pre class="notranslate"><code class="notranslate">TASK [configure fstab for alpha] ***********************************************
fatal: [cluster-node01]: FAILED! =&gt; {"changed": false, "failed": true, "msg": "Error mounting /srv/foo/alpha: mount.nfs4: /srv/foo/alpha is busy or already mounted\n"}
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">I expect the documented behaviour:<br>
<a href="http://docs.ansible.com/ansible/mount_module.html" rel="nofollow">http://docs.ansible.com/ansible/mount_module.html</a></p>
<p dir="auto"><code class="notranslate">If mounted or unmounted, the device will be actively mounted or unmounted as needed and appropriately configured in fstab.</code></p>
<p dir="auto">Obviously, if a mount is already mounted, mounting it again is <em>not</em> needed and triggers the error and further execution of the playbook.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [configure fstab for alpha] ***********************************************
fatal: [cluster-node01]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;msg&quot;: &quot;Error mounting /srv/foo/alpha: mount.nfs4: /srv/foo/alpha is busy or already mounted\n&quot;}"><pre class="notranslate"><code class="notranslate">TASK [configure fstab for alpha] ***********************************************
fatal: [cluster-node01]: FAILED! =&gt; {"changed": false, "failed": true, "msg": "Error mounting /srv/foo/alpha: mount.nfs4: /srv/foo/alpha is busy or already mounted\n"}
</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="150254685" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/3514" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/3514/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/3514">ansible/ansible-modules-core#3514</a></p>
<p dir="auto">Today I tested the devil branch a home and I found out that gathering facts failed, because a locale ('de_DE') is set.<br>
The Problem is that the split operation on the ifconfig ouput doesn't work properly. (Line 458 in setup module)</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="cmd = subprocess.Popen(&quot;env LANG=\&quot;\&quot; /sbin/ifconfig %s&quot; % iface, shell=True,
                                   stdout=subprocess.PIPE, stderr=subprocess.PIPE)"><pre class="notranslate"><span class="pl-s1">cmd</span> <span class="pl-c1">=</span> <span class="pl-s1">subprocess</span>.<span class="pl-v">Popen</span>(<span class="pl-s">"env LANG=<span class="pl-cce">\"</span><span class="pl-cce">\"</span> /sbin/ifconfig %s"</span> <span class="pl-c1">%</span> <span class="pl-s1">iface</span>, <span class="pl-s1">shell</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
                                   <span class="pl-s1">stdout</span><span class="pl-c1">=</span><span class="pl-s1">subprocess</span>.<span class="pl-v">PIPE</span>, <span class="pl-s1">stderr</span><span class="pl-c1">=</span><span class="pl-s1">subprocess</span>.<span class="pl-v">PIPE</span>)</pre></div>
<p dir="auto">I tried the code above. It fixes the issue.</p>