---
- name: Ensure directory
  file:
    path: "{{ cikit_pantheon_terminus.dir }}/terminus"
    state: directory
  register: terminus_dir

- name: Set path to executable
  set_fact:
    terminus_bin: "{{ terminus_dir.path }}/vendor/bin/terminus"

- name: Download
  get_url:
    url: https://raw.githubusercontent.com/pantheon-systems/terminus-installer/master/builds/installer.phar
    dest: "{{ terminus_dir.path }}/terminus-installer.phar"
  register: terminus_installer

- name: Install
  become_user: "{{ ansible_user }}"
  shell: "php {{ terminus_installer.dest }} install --install-dir={{ terminus_dir.path }}"
  args:
    creates: "{{ terminus_bin }}"

- name: Ensure executable
  file:
    src: "{{ terminus_bin }}"
    dest: "{{ cikit_pantheon_terminus.bin }}/{{ terminus_bin | basename }}"
    state: link
    mode: a+x

- name: Ensure system directory
  file:
    path: "{{ cikit_pantheon_terminus.dir }}/.terminus"
    state: directory
    recurse: yes

---
- name: Ensure directory
  file:
    path: "{{ cikit_pantheon_terminus.dir }}/terminus"
    state: directory
  register: terminus_dir

- name: Set path to executable
  set_fact:
    terminus_bin: "{{ terminus_dir.path }}/vendor/bin/terminus"

- name: Download
  get_url:
    url: https://raw.githubusercontent.com/pantheon-systems/terminus-installer/master/builds/installer.phar
    dest: "{{ terminus_dir.path }}/terminus-installer.phar"
  register: terminus_installer

- name: Install
  shell: "php {{ terminus_installer.dest }} install --install-dir={{ terminus_dir.path }}"
  args:
    creates: "{{ terminus_bin }}"

- name: Ensure executable
  file:
    src: "{{ terminus_bin }}"
    dest: "{{ cikit_pantheon_terminus.bin }}/{{ terminus_bin | basename }}"
    state: link
    mode: a+x

- name: Ensure system directory
  file:
    path: "{{ cikit_pantheon_terminus.dir }}/.terminus"
    state: directory
    recurse: yes

Fix Terminus installation in VM
[CIKit] Fix Terminus installation in VM
