Run tasks only when packages are installed

This commit is contained in:
phil 2023-02-06 22:51:32 +01:00
parent ef238e83df
commit 9a97b43cbf
2 changed files with 7 additions and 0 deletions

View file

@ -22,6 +22,7 @@
src: munin_configuration src: munin_configuration
dest: /etc/munin/plugin-conf.d/yyy-apache dest: /etc/munin/plugin-conf.d/yyy-apache
mode: 0644 mode: 0644
when: munin in ansible_facts.packages
notify: restart munin-node notify: restart munin-node
- name: "Monitoring | Enable Munin plugins" - name: "Monitoring | Enable Munin plugins"
@ -33,6 +34,7 @@
- apache_accesses - apache_accesses
- apache_processes - apache_processes
- apache_volume - apache_volume
when: munin in ansible_facts.packages
notify: restart munin-node notify: restart munin-node
- name: "Monitoring | Enable Monit configuration" - name: "Monitoring | Enable Monit configuration"
@ -40,4 +42,5 @@
src: monit.conf src: monit.conf
dest: /etc/monit/conf-enabled/apache2 dest: /etc/monit/conf-enabled/apache2
mode: 0644 mode: 0644
when: monit in ansible_facts.packages
notify: reload monit notify: reload monit

View file

@ -1,4 +1,8 @@
--- ---
- name: "Packages | Get installed packages"
ansible.builtin.package_facts:
manager: apt
- name: "Packages | Install packages" - name: "Packages | Install packages"
ansible.builtin.apt: ansible.builtin.apt:
pkg: pkg: