Skip to content

Instantly share code, notes, and snippets.

@ciiqr
Last active February 10, 2019 21:33
Show Gist options
  • Save ciiqr/70c4b82b5c368ab86113d36c7aa9eba3 to your computer and use it in GitHub Desktop.
Save ciiqr/70c4b82b5c368ab86113d36c7aa9eba3 to your computer and use it in GitHub Desktop.
Ansible: Conditional Roles
- hosts: all
gather_facts: no
roles:
# Platforms
- { role: linux, when: platform == 'linux' }
- { role: osx, when: platform == 'osx' }
- { role: windows, when: platform == 'windows' }
# OS
- { role: ubuntu, when: distribution == 'ubuntu' }
- { role: void, when: distribution == 'void' }
# Roles
- { role: base, when: "'base' in roles" }
- { role: ssh, when: "'ssh' in roles" }
- { role: gpg, when: "'gpg' in roles" }
- { role: frontend, when: "'frontend' in roles" }
- { role: sublime, when: "'sublime' in roles" }
- { role: quick-launch, when: "'quick-launch' in roles" }
- { role: development, when: "'development' in roles" }
- { role: hidpi, when: "'hidpi' in roles" }
# Machine
- { role: laptop-william, when: machine == 'laptop-william' }
- { role: desktop-william, when: machine == 'desktop-william' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment