add playbook and role to remove packages
This commit is contained in:
parent
9088458b5d
commit
10343d8f36
14
ansible/02-remove-packages.yml
Normal file
14
ansible/02-remove-packages.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Install Packages
|
||||||
|
become: true
|
||||||
|
hosts: pibox
|
||||||
|
tasks:
|
||||||
|
- name: Loop over packages_to_remove and remove them
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: apt-remove-package
|
||||||
|
loop: "{{ packages_to_remove }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: package
|
||||||
|
|
||||||
|
...
|
10
ansible/roles/apt-remove-package/tasks/main.yml
Normal file
10
ansible/roles/apt-remove-package/tasks/main.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: "Remove {{ package }}"
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
name: "{{ package }}"
|
||||||
|
state: absent
|
||||||
|
failed_when: package is undefined
|
||||||
|
|
||||||
|
...
|
Loading…
Reference in New Issue
Block a user