This lab demonstrates how to dynamically install multiple packages using Ansible by defining them in the inventory file. It uses loops and variables to make the playbook reusable and adaptable.
/home/user/workspace/
├── inventory
└── app_install.yamlmkdir -p /home/user/workspace
cd /home/user/workspace/vi inventory[all]
server1 ansible_host=server1 ansible_user=server1_admin ansible_ssh_pass=server1_admin@123!
[all:vars]
package_list=['nginx', 'apache2', 'git']Defines a variable package_list for dynamic package installation.
vi app_install.yaml---
- name: Insta