<p dir="auto">When adding a host entry using the hosts module, if the name matches an existing entry with a different ip, the entire entry line is removed, even if it contains other aliases. I would expect it to leave the other entries in place.</p>
<p dir="auto">Ever more so, if the entry for the current name/ip exists AND the name exists in another entry, the other entry line is removed and a second instance of the existing entry is added.</p>
<p dir="auto">with <code class="notranslate">ip=192.168.3.10 hostname=vagrant-chef-server state=present</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="127.0.0.1   vagrant-chef-server vagrant-chef-server localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6"><pre class="notranslate"><code class="notranslate">127.0.0.1   vagrant-chef-server vagrant-chef-server localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
</code></pre></div>
<p dir="auto">bacame:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="192.168.3.10 vagrant-chef-server
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6"><pre class="notranslate"><code class="notranslate">192.168.3.10 vagrant-chef-server
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
</code></pre></div>
<p dir="auto">and if I fix that file to put 127.0.0.1 back, the next run produces:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="192.168.3.10 vagrant-chef-server
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.3.10 vagrant-chef-server"><pre class="notranslate"><code class="notranslate">192.168.3.10 vagrant-chef-server
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.3.10 vagrant-chef-server
</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">ovirt_storage_domains</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">In the documentation it's stated that we can remove SDs like this:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/ansible/ansible/blob/0566d4672dd30e374ab8fdf24465e143418bf911/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py#L208-L212">ansible/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 208 to 212
      in
      <a data-pjax="true" class="commit-tease-sha" href="/ansible/ansible/commit/0566d4672dd30e374ab8fdf24465e143418bf911">0566d46</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L208" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="208"></td>
          <td id="LC208" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s"># Remove storage domain</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L209" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="209"></td>
          <td id="LC209" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s">- ovirt_storage_domains:</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L210" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="210"></td>
          <td id="LC210" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s">    state: absent</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L211" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="211"></td>
          <td id="LC211" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s">    name: mystorage_domain</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L212" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="212"></td>
          <td id="LC212" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s">    format: true</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">But it's not working, since dc is required parameter for the module:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/ansible/ansible/blob/0566d4672dd30e374ab8fdf24465e143418bf911/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py#L473">ansible/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 473
      in
      <a data-pjax="true" class="commit-tease-sha" href="/ansible/ansible/commit/0566d4672dd30e374ab8fdf24465e143418bf911">0566d46</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L473" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="473"></td>
          <td id="LC473" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">data_center</span><span class="pl-c1">=</span><span class="pl-en">dict</span>(<span class="pl-s1">required</span><span class="pl-c1">=</span><span class="pl-c1">True</span>), </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">Even if removing the <code class="notranslate">required == True</code> if will fail since in the <code class="notranslate">pre-remove</code> step the <code class="notranslate">attached_sd_service</code>  is used, and in order to get it, you implicitly use the DC name provided in parameters.</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/ansible/ansible/blob/0566d4672dd30e374ab8fdf24465e143418bf911/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py#L330-L339">ansible/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 330 to 339
      in
      <a data-pjax="true" class="commit-tease-sha" href="/ansible/ansible/commit/0566d4672dd30e374ab8fdf24465e143418bf911">0566d46</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L330" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="330"></td>
          <td id="LC330" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">def</span> <span class="pl-en">_attached_sds_service</span>(<span class="pl-s1">self</span>): </td>
        </tr>

        <tr class="border-0">
          <td id="L331" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="331"></td>
          <td id="LC331" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-c"># Get data center object of the storage domain:</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L332" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="332"></td>
          <td id="LC332" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">dcs_service</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">_connection</span>.<span class="pl-en">system_service</span>().<span class="pl-en">data_centers_service</span>() </td>
        </tr>

        <tr class="border-0">
          <td id="L333" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="333"></td>
          <td id="LC333" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">  </td>
        </tr>

        <tr class="border-0">
          <td id="L334" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="334"></td>
          <td id="LC334" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-c"># Serach the data_center name, if it does not exists, try to search by guid.</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L335" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="335"></td>
          <td id="LC335" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-s1">dc</span> <span class="pl-c1">=</span> <span class="pl-en">search_by_name</span>(<span class="pl-s1">dcs_service</span>, <span class="pl-s1">self</span>.<span class="pl-s1">_module</span>.<span class="pl-s1">params</span>[<span class="pl-s">'data_center'</span>]) </td>
        </tr>

        <tr class="border-0">
          <td id="L336" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="336"></td>
          <td id="LC336" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">if</span> <span class="pl-s1">dc</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L337" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="337"></td>
          <td id="LC337" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-s1">dc</span> <span class="pl-c1">=</span> <span class="pl-s1">dcs_service</span>.<span class="pl-en">service</span>(<span class="pl-s1">self</span>.<span class="pl-s1">_module</span>.<span class="pl-s1">params</span>[<span class="pl-s">'data_center'</span>]).<span class="pl-en">get</span>() </td>
        </tr>

        <tr class="border-0">
          <td id="L338" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="338"></td>
          <td id="LC338" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-k">if</span> <span class="pl-s1">dc</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L339" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="339"></td>
          <td id="LC339" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">             <span class="pl-k">return</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">This is problematic from my view, since some SD can be in unattached state, in this case DC name parameter doesn't make sense and the pre-remove step should be skipped.</p>
<p dir="auto">But in any case I think we should use the absent state as described in example, without any specification of datacenter.</p>