Create playbook and role to install packages
This commit is contained in:
parent
9056a38e4b
commit
3fb0d66a4a
14
ansible/01-install-packages.yml
Normal file
14
ansible/01-install-packages.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Install Packages
|
||||||
|
become: true
|
||||||
|
hosts: pibox
|
||||||
|
tasks:
|
||||||
|
- name: Loop over packages_to_install and install them
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: apt-install-package
|
||||||
|
loop: packages_to_install
|
||||||
|
loop_control:
|
||||||
|
loop_var: package
|
||||||
|
|
||||||
|
...
|
10
ansible/roles/apt-install-package/tasks/main.yml
Normal file
10
ansible/roles/apt-install-package/tasks/main.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: "Install {{ package }}"
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
name: "{{ package }}"
|
||||||
|
state: latest
|
||||||
|
failed_when: package is unset
|
||||||
|
|
||||||
|
...
|
Loading…
Reference in New Issue
Block a user