Skip to content

Instantly share code, notes, and snippets.

@hostmaster
Created October 3, 2014 06:38
Show Gist options
  • Save hostmaster/db37c8e6c2a43997a224 to your computer and use it in GitHub Desktop.
Save hostmaster/db37c8e6c2a43997a224 to your computer and use it in GitHub Desktop.
Use OS specific package manager. Names of the packages may vary per distro/OS
---
- hosts: all
sudo: True
tasks:
# Load a variable file based on the OS type, or a default if not found.
- include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "default.yml"
- action: '{{ pkg_mgr }} name={{ item }} state=latest'
with_items: packages
pkg_mgr: apt
packages:
- bash
- screen
- curl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment