Skip to content

Instantly share code, notes, and snippets.

---
- name: Ensure git is installed (Debian).
apt: name={{ item }} state=installed
with_items: git_packages
# Install git from source when git_install_from_source is true.
- include: install-from-source.yml
when: git_install_from_source == true
- command: grep string file
ignore_errors: yes
register: result
# How to set this fact so that it is a boolean variable, not a string?
- set_fact:
got_string: "{{ (result|success)|bool }}"
- hosts: web
serial: 1
tasks:
- include: includes/{{ inventory_class }}_web_update.yml
- hosts: core
serial: 1
tasks:
---
# this play queries all servers and creates groups
- hosts: all
remote_user: root
# remote_user: someuser
# sudo: true
tasks:
- name: create dynamic groups based on OS
group_by: key=ansible_os_family
---
- hosts: all
remote_user: root
tasks:
- name: Say bar
shell: echo "bar"
tasks:
- name: install prerequisite packages
apt:
update_cache: yes
name: "{{ item }}"
install_recommends: no
state: latest
with_items:
- nginx
- python-pip
@tgerla
tgerla / example_playbook.yml
Created October 22, 2015 18:56
Simple aplybook example
# Example Playbook for ACLs
---
- hosts: all
connection: local
vars:
force: "false"
vars_prompt: