title: Is it safe to use ansible's package module to upgrade all packages?
body: <p>I have a numer of ansible playbooks I use to perform certain actions on Debian and CentOS VMs. Until now, when I needed to handle packages I would use ansible modules <a href="https://docs.ansible.com/ansible/apt_module.html" rel="nofollow noreferrer">apt</a> and <a href="https://docs.ansible.com/ansible/yum_module.html" rel="nofollow noreferrer">yum</a>. Consequently, I had to check which OS was installed and then use the correct ansible module.</p>
  
  <p>However, I've recently learned there's a module called <a href="https://docs.ansible.com/ansible/package_module.html" rel="nofollow noreferrer">package</a> which somehow unifies package managers, reducing playbook's complexity, so I'm now trying to use this module only.</p>
  
  <p>One of the operations I want to perform is to update all packages. The problem is that <a href="https://docs.ansible.com/ansible/package_module.html" rel="nofollow noreferrer">ansible's documentation</a> doesn't say how to do this using <em>package</em>. It does say, however, how to do it with <em>apt</em> and <em>yum</em>: the first one uses and upgrade operation and the latter suggests writing something like:</p>
  
  <pre><code>yum: name=* state=latest
  </code></pre>
  
  <p>For this reason I thought I could use <em>package</em> to do the following:</p>
  
  <pre><code>package: name=* state=latest
  </code></pre>
  
  <p>When I ran this playbook I didn't come across any error but this isn't documented anywhere and <em>apt</em> and <em>yum</em> don't work exactly the same way. So my question is: is the command above a safe one as in does it actually do what I want it to do?</p>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT:</p>
  
  <p>I have found out that using <code>package: name=* state=latest</code> will try to install or update all available packages instead of just updating installed ones. Therefore this isn't a valid solution for me. Alternatively, I can keep using <em>yum</em> and <em>apt</em> for this particular action, but I do wonder why is it not possible to do this using <em>package</em>, or if I'm missing something.</p>