What does state=installed
mean in ansible apt?
- name: Install Node.js
apt:
pkg:
- nodejs
state: installed
update_cache: yes
It is not mentioned in the docs nor elsewhere.
State as 'Present' and 'Installed' are used interchangeably. They both do the same thing i.e. it will ensure that a desired package in your case 'yum' is installed. Whereas State as 'Latest' means in addition to installation, it will go ahead and update if it is not of the latest available version.
Ansible's apt module is used to manage packages with the apt package manager, which is the default on Debian based Linux distributions such as Debian and Ubuntu. Most systems require root/superuser permissions to manage packages, which means that become: true is required.
If we look into the code:
# Deal with deprecated aliases
if p['state'] == 'installed':
p['state'] = 'present'
if p['state'] == 'removed':
p['state'] = 'absent'
installed
is a deprecated form of present
,removed
is a deprecated form of absent
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With