<p dir="auto">Hi,</p>
<p dir="auto">I just <strong>upgraded from 1.8.4 to 1.9.0.1</strong> and while my roles and inventory SSH configuration are unchanged:</p>
<p dir="auto"><strong>Inventory SSH Configuration:</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[group1:vars]
ansible_ssh_user=deployment
ansible_ssh_private_key_file=./files/dev/deployment_rsa
ansible_sudo_pass=password123"><pre class="notranslate"><code class="notranslate">[group1:vars]
ansible_ssh_user=deployment
ansible_ssh_private_key_file=./files/dev/deployment_rsa
ansible_sudo_pass=password123
</code></pre></div>
<p dir="auto"><strong>my_role/vars/main.yml:</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
sudo: yes"><pre class="notranslate"><code class="notranslate">
---
sudo: yes
</code></pre></div>
<p dir="auto"><strong>This previously working task my_role/tasks/main.yml:</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
- name: install jdk
  yum: pkg=jdk-{{ jdk_package_version }} state=present"><pre class="notranslate"><code class="notranslate">
---
- name: install jdk
  yum: pkg=jdk-{{ jdk_package_version }} state=present
</code></pre></div>
<p dir="auto"><strong>is now failing with:</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="failed: [host1] =&gt; {&quot;failed&quot;: true}
msg: Error from repoquery: ['/usr/bin/repoquery', '--show-duplicates', '--plugins', '--quiet', '-q', '--disablerepo=*', '--pkgnarrow=installed', '--qf', '%{name}-%{version}-%{release}.%{arch}', 'jdk-1.2.27.1.0-3707']: Could not set cachedir: [Errno 13] Permission denied: '/var/tmp/yum-deployment-aVYwNt'
Error: Could not make cachedir, exiting"><pre class="notranslate"><code class="notranslate">failed: [host1] =&gt; {"failed": true}
msg: Error from repoquery: ['/usr/bin/repoquery', '--show-duplicates', '--plugins', '--quiet', '-q', '--disablerepo=*', '--pkgnarrow=installed', '--qf', '%{name}-%{version}-%{release}.%{arch}', 'jdk-1.2.27.1.0-3707']: Could not set cachedir: [Errno 13] Permission denied: '/var/tmp/yum-deployment-aVYwNt'
Error: Could not make cachedir, exiting
</code></pre></div>
<p dir="auto">whereas before the ansible upgrade it was working fine. I am <strong>not</strong> passing any sudo / user related configuration in CLI.</p>
<p dir="auto">If I add sudo: yes to every task in the tasks/main.yml it works, but clearly this is not something I want to do.</p>
<p dir="auto">Has something changed in the sudo / user precedence in the new ansible version that I should know about? This seems like a bug to me but I could be wrong..</p>
<p dir="auto">Thanks in advance,<br>
Yannis</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">network namespace</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">none</p>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">n/a</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Linux</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Ansible currently has no support for Linux network namespaces. It would be highly useful to get at least basic support for them via facts. Right now, if an interface is a non-default network namespace, ansible won't detect it at all, and it wont show up in fact variables such as <code class="notranslate">ansible_interfaces</code> or <code class="notranslate">ansible_{{ifname}}</code>.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Have an interface in a non-default network namespace.</p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Interface details to show up in facts such as <code class="notranslate">ansible_interfaces</code> and <code class="notranslate">ansible_{{ifname}}</code>.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">Interface details missing.</p>
<h5 dir="auto">Details</h5>
<p dir="auto">Writing a custom fact for this would be very cumbersome as ansible gathers a lot of information about the interfaces and state of networking that would have to be duplicated.</p>
<p dir="auto">I think it might be simple to support this by getting a list of network namespaces, and then running the <code class="notranslate">setup</code> module again inside each network namespace (via <code class="notranslate">ip netns exec</code>). Could also enhance that by only gathering the network related facts. The resulting variables would then be available inside a <code class="notranslate">netns_{{nsname}}</code> tree. For example:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;ansible_network_namespaces&quot;: [&quot;foo&quot;,&quot;bar&quot;],
  &quot;ansible_netns_foo&quot;: {
    &quot;ansible_all_ipv4_addresses&quot;: [ &quot;1.2.3.4&quot; ],
    &quot;ansible_interfaces: [ &quot;iffoo&quot; ],
    &quot;ansible_iffoo&quot;: { &quot;ipv4&quot;: { &quot;address&quot;: &quot;1.2.3.4&quot;, &quot;netmask&quot;: ... } },
    ...
  },
  &quot;ansible_netns_bar&quot;: {
    &quot;ansible_all_ipv4_addresses&quot;: [ &quot;5.6.7.8&quot; ],
    &quot;ansible_interfaces: [ &quot;ifbar&quot; ],
    &quot;ansible_ifbar&quot;: { &quot;ipv4&quot;: { &quot;address&quot;: &quot;5.6.7.8&quot;, &quot;netmask&quot;: ... } },
    ...
  },"><pre class="notranslate">{
  <span class="pl-ent">"ansible_network_namespaces"</span>: [<span class="pl-s"><span class="pl-pds">"</span>foo<span class="pl-pds">"</span></span>,<span class="pl-s"><span class="pl-pds">"</span>bar<span class="pl-pds">"</span></span>],
  <span class="pl-ent">"ansible_netns_foo"</span>: {
    <span class="pl-ent">"ansible_all_ipv4_addresses"</span>: [ <span class="pl-s"><span class="pl-pds">"</span>1.2.3.4<span class="pl-pds">"</span></span> ],
    <span class="pl-s"><span class="pl-pds">"</span>ansible_interfaces: [ <span class="pl-pds">"</span></span><span class="pl-ii">iffoo" ],</span>
    <span class="pl-ent">"ansible_iffoo"</span>: { <span class="pl-ent">"ipv4"</span>: { <span class="pl-ent">"address"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.2.3.4<span class="pl-pds">"</span></span>, <span class="pl-ent">"netmask"</span>: <span class="pl-ii">... </span>} },
    <span class="pl-ii">...</span>
  },
  <span class="pl-ent">"ansible_netns_bar"</span>: {
    <span class="pl-ent">"ansible_all_ipv4_addresses"</span>: [ <span class="pl-s"><span class="pl-pds">"</span>5.6.7.8<span class="pl-pds">"</span></span> ],
    <span class="pl-s"><span class="pl-pds">"</span>ansible_interfaces: [ <span class="pl-pds">"</span></span><span class="pl-ii">ifbar" ],</span>
    <span class="pl-ent">"ansible_ifbar"</span>: { <span class="pl-ent">"ipv4"</span>: { <span class="pl-ent">"address"</span>: <span class="pl-s"><span class="pl-pds">"</span>5.6.7.8<span class="pl-pds">"</span></span>, <span class="pl-ent">"netmask"</span>: <span class="pl-ii">... </span>} },
    <span class="pl-ii">...</span>
  },</pre></div>