Skip to content

Instantly share code, notes, and snippets.

@decentral1se
Created September 14, 2018 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save decentral1se/1d1c193a9f1b8779cdea504cc9465ec2 to your computer and use it in GitHub Desktop.
Save decentral1se/1d1c193a9f1b8779cdea504cc9465ec2 to your computer and use it in GitHub Desktop.
groupby.yml
---
- hosts: localhost
connection: local
tasks:
- name: Ensure mandatory variables specified
assert:
that: env is defined
- name: Show execution path
debug:
msg: "USING ENVIRONMENT: {{ env }}"
- hosts: dev
vars_prompt:
- name: prompted_mysql_root_password
prompt: MySQL root password
- name: ansible_become_pass
prompt: SUDO password
private: true
tasks:
- name: Import dev tasks
import_tasks: dev/main.yml
- hosts: stage
tasks:
- name: Import stage tasks
import_tasks: stage/main.yml
when: env == 'stage'
- hosts: prod
tasks:
- name: Import prod tasks
import_tasks: prod/main.yml
when: env == 'prod'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment