Skip to content

Instantly share code, notes, and snippets.

@orlissenberg
Last active August 29, 2015 14:26
Show Gist options
  • Save orlissenberg/c3a9441a230f151b6227 to your computer and use it in GitHub Desktop.
Save orlissenberg/c3a9441a230f151b6227 to your computer and use it in GitHub Desktop.
Ansible tricks.
---
# http://docs.ansible.com/ansible/playbooks_conditionals.html
- name: Get platform specific variables.
include_vars: "{{ansible_os_family}}.yml"
when: ansible_os_family == "Debian" or ansible_os_family == "RedHat"
# Ansible 1.9 introduced the new becomes syntax
# http://stackoverflow.com/questions/21344777/how-to-switch-a-user-per-task-or-set-of-tasks
- name: checkout repo
git: repo=https://github.com/some/repo.git version=master dest={{ dst }}
become: yes
become_user: some_user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment