- include: "Darwin_reqs.yml"
  when: os_family == "Darwin"

- include: "RedHat_reqs.yml"
  when: os_family == "RedHat"

- include: "Debian_reqs.yml"
  when: os_family == "Debian"

- name: install lein into the src folder
  register: clone_leiningen
  # it's kind of funny, but we can't set the dest to leiningen otherwise the
  # shell script they're using gets confused and complains about bootstrapping
  git: >
    repo=https://github.com/technomancy/leiningen.git
    dest={{ home }}/src/lein
    version=2.3.4

- name: copy the bin script in
  register: copy_leiningen
  copy: >
    src="{{ home }}/src/lein/bin/lein"
    dest="{{ home }}/managed-bin/lein"
    mode=755
    owner={{ ansible_user_id }}

- name: run the lein bootstrap script
  when: copy_leiningen|changed or clone_leiningen|changed
  shell: cd && bash -lc "lein"

- include: "Darwin_reqs.yml"
  when: os_family == "Darwin"

- include: "RedHat_reqs.yml"
  when: os_family == "RedHat"

- include: "Debian_reqs.yml"
  when: os_family == "Debian"

- name: install lein into the src folder
  register: clone_leiningen
  # it's kind of funny, but we can't set the dest to leiningen otherwise the
  # shell script they're using gets confused and complains about bootstrapping
  git: >
    repo=https://github.com/technomancy/leiningen.git
    dest={{ home }}/src/lein
    version=2.3.4

- name: delete the old version of lein from managed-bin
  when: clone_leiningen|changed
  file: path={{ home }}/managed-bin/lein state=absent

- name: copy the bin script in
  register: copy_leiningen
  command: >
    cp {{ home }}/src/lein/bin/lein {{ home }}/managed-bin/lein
    creates={{ home }}/managed-bin/lein

- name: chmod +x the bin script
  when: copy_leiningen|changed
  file: >
    path="{{ home }}/managed-bin/lein"
    mode=755
    owner={{ ansible_user_id }}

- name: run the lein bootstrap script
  when: copy_leiningen|changed or clone_leiningen|changed
  shell: cd && bash -lc "lein"

Stop using the copy module in clojure / lein
Stop using the copy module in clojure / lein

Copy module goes from local -> remote so it works when your remote
target is your local target but not when you're working on an actual
remote node and Ansible offers no way of doing exactly what I want
without the command module so fuck
