- name: setup mirror vm
  hosts: 127.0.0.1
  gather_facts: no
  tasks:
    - name: get hostname
      command: "hostname"
      changed_when: false
      ignore_errors: true
      register: hostname

    - name: fail when hostname is not mirror
      fail:
        msg: DO NOT run this on your host machine!
      when: hostname.stdout != "mirror"

    - name: run the system role first
      include_role: 
        name: "../roles/system"

    - name: run mirror system role second
      include_role: 
        name: "../roles/mirror"

    - name: run the rest of the roles
      include_role:
        name: "{{ roleinputvar }}"
      loop:
        - "../roles/ftp"
        - "../roles/nginx"
        - "../roles/rsync"
        - "../roles/ssh"
      loop_control:
        loop_var: roleinputvar
