---
- name:       Check if JumpCloud folder exists
  stat:
    path:     "{{ jumpcloud_directory }}"
  register:   jumpcloud_directory_stat

- name:       Determine if JumpCloud is already installed
  set_fact:
    jc_not_installed: "{{ not (jumpcloud_directory_stat.stat.isdir is defined and jumpcloud_directory_stat.stat.isdir) }}"

- name:       Install JumpCloud if required
  include:    install.yml
  when:       jc_not_installed or jumpcloud_force_install

---
- name:       Check if JumpCloud folder exists
  stat:
    path:     "{{ jumpcloud_directory }}"
  register:   jumpcloud_directory_stat

- name:       Determine if JumpCloud is already installed
  set_fact:
    jc_not_installed: "{{ not (jumpcloud_directory_stat.stat.isdir is defined and jumpcloud_directory_stat.stat.isdir) }}"

- name:       Install JumpCloud if required
  include:    install.yml
  when:       jc_not_installed or jumpcloud_force_install

- name:       Ensure jcagent is enabled and started
  become: "{{ jumpcloud_use_sudo }}"
  service: name=jcagent enabled=true state=running

Enable the service and ensure it's running.
Enable the service and ensure it's running.
