summaryrefslogtreecommitdiffstats
path: root/src/ansiblelint/rules/package_latest.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/ansiblelint/rules/package_latest.md')
-rw-r--r--src/ansiblelint/rules/package_latest.md18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ansiblelint/rules/package_latest.md b/src/ansiblelint/rules/package_latest.md
index c7e0d82..c965548 100644
--- a/src/ansiblelint/rules/package_latest.md
+++ b/src/ansiblelint/rules/package_latest.md
@@ -7,7 +7,7 @@ In production environments, you should set `state` to `present` and specify a ta
Setting `state` to `latest` not only installs software, it performs an update and installs additional packages.
This can result in performance degradation or loss of service.
-If you do want to update packages to the latest version, you should also set the `update_only` parameter to `true` to avoid installing additional packages.
+If you do want to update packages to the latest version, you should also set the `update_only` or `only_upgrade` parameter to `true` based on package manager to avoid installing additional packages.
## Problematic Code
@@ -32,11 +32,17 @@ If you do want to update packages to the latest version, you should also set the
name: some-package
state: latest # <- Installs the latest package.
- - name: Install Ansible with update_only to false
+ - name: Install sudo with update_only to false
ansible.builtin.yum:
name: sudo
state: latest
update_only: false # <- Updates and installs packages.
+
+ - name: Install sudo with only_upgrade to false
+ ansible.builtin.apt:
+ name: sudo
+ state: latest
+ only_upgrade: false # <- Upgrades and installs packages
```
## Correct Code
@@ -63,9 +69,15 @@ If you do want to update packages to the latest version, you should also set the
name: some-package
state: present # <- Ensures the package is installed.
- - name: Update Ansible with update_only to true
+ - name: Update sudo with update_only to true
ansible.builtin.yum:
name: sudo
state: latest
update_only: true # <- Updates but does not install additional packages.
+
+ - name: Install sudo with only_upgrade to true
+ ansible.builtin.apt:
+ name: sudo
+ state: latest
+ only_upgrade: true # <- Upgrades but does not install additional packages.
```