Files
Ansible/Playbook/PB-Loop.yml
T
2026-10-18 16:41:04 +02:00

27 lines
657 B
YAML

---
- name: Installation groupées
hosts: all
become: yes
become_user: root
tasks:
- name: "install NTP & VI on Debian"
when: ansible_distribution == "Debian"
ansible.builtin.apt: pkg={{ item }}
loop:
- ntp
- vim
- name: "Uninstall NTP & VI on RedHat with vars"
when: ansible_distribution == "Rocky" or ansible_distribution == 'Red Hat Enterprise Linux'
vars:
ServiceName:
- chrony
- vi
ansible.builtin.dnf:
name: "{{ ServiceName }}"
state: absent
# state: present
loop:
- "{{ ServiceName }}"
- "{{ ServiceName }}"