# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag.  See README for instructions on how to use.
- hosts: ~tag_Name_{{machine}}_prod
  pre_tasks:
  - fail: msg="This playbook only runnable on 'app' machines"
    when: "'app' not in machine"
  sudo: True
  post_tasks:
  - shell: sudo bash ./fix-datadog.sh
    args:
        chdir: /home/nparlante
  vars:
    secure_dir: '../../../edx-secret/ansible'
    # this indicates the path to site-specific (with precedence)
    # things like nginx template files
    local_dir:  '../../../edx-secret/ansible/local'
    not_prod: false
  vars_files:
    - "{{ secure_dir }}/vars/edxapp_prod_vars.yml"
    - "{{ secure_dir }}/vars/edxapp_prod_users.yml"
    - "{{ secure_dir }}/vars/shib_prod_vars.yml"
    - "{{ secure_dir }}/vars/datadog_prod.yml"
  roles:
    - common
    - supervisor
    - role: user
      tags: users
    - role: nginx
      nginx_sites:
        - lms
        - cms
        - verify
      nginx_template_directory: "{{local_dir}}/nginx/templates/"
      nginx_default_sites:
        - lms
      tags: nginx
    - edxapp
    - apache
    - shibboleth
    - datadog
    #- splunkforwarder
    # run this role last
    #- in_production

# This uses variable expansion so you can select machine(s) from the command line
# using the -e flag.  See README for instructions on how to use.
- hosts: ~tag_Name_{{machine}}_prod
  pre_tasks:
  - fail: msg="This playbook only runnable on 'app' machines"
    when: "'app' not in machine"
  sudo: True
  post_tasks:
  - shell: test -f ./fix-datadog.sh && sudo bash ./fix-datadog.sh || echo 'skipping ./fix-datadog.sh'
    args:
        chdir: /home/nparlante
  vars:
    secure_dir: '../../../edx-secret/ansible'
    # this indicates the path to site-specific (with precedence)
    # things like nginx template files
    local_dir:  '../../../edx-secret/ansible/local'
    not_prod: false
  vars_files:
    - "{{ secure_dir }}/vars/edxapp_prod_vars.yml"
    - "{{ secure_dir }}/vars/edxapp_prod_users.yml"
    - "{{ secure_dir }}/vars/shib_prod_vars.yml"
    - "{{ secure_dir }}/vars/datadog_prod.yml"
  roles:
    - common
    - supervisor
    - role: user
      tags: users
    - role: nginx
      nginx_sites:
        - lms
        - cms
        - verify
      nginx_template_directory: "{{local_dir}}/nginx/templates/"
      nginx_default_sites:
        - lms
      tags: nginx
    - edxapp
    - apache
    - shibboleth
    - datadog
    #- splunkforwarder
    # run this role last
    #- in_production

Fix DataDog iff script exists
Fix DataDog iff script exists
