Ansible - how to remove an item from a list?
<p>I'd like to remove an item from a list, based on another list.</p>
<pre class="lang-yaml prettyprint-override"><code>&quot;my_list_one&quot;: [
  &quot;item1&quot;,
  &quot;item2&quot;,
  &quot;item3&quot;
]
</code></pre>
<p>My second list:</p>
<pre class="lang-yaml prettyprint-override"><code>&quot;my_list_two&quot;: [
  &quot;item3&quot;
]
</code></pre>
<p>How do I remove 'item3' from this list, to set a new fact?<br />
I tried using '-' and union, but this does not end in the desired end result.</p>
<pre class="lang-yaml prettyprint-override"><code>set_fact: 
  my_list_one: &quot;{{ my_list_one | union(my_list_two) }}&quot;
</code></pre>
<p>End goal:</p>
<pre class="lang-yaml prettyprint-override"><code>&quot;my_list_one&quot;: [
  &quot;item1&quot;,
  &quot;item2&quot;
]
</code></pre>