
- name: Install zaccess
  become: yes
  get_url:
    # From https://confluence.zooxlabs.com/display/VS/zAccess
    url:  "https://artifactory.zooxlabs.com/artifactory/RSI/zaccess/2020-09-18/zaccess"
    dest: "/usr/bin/zaccess"
    checksum: "sha256:9518a074755353e5626083fdf781f35122aa2f07a3b0e4beb5732276dadc12b7"

# Set the permissions of the zaccess executable after it's downloaded. This
# used to be a bug in Ansible but it doesn't appear to be fixed in the version
# that we're using. https://github.com/ansible/ansible/issues/11821
- name: Set zaccess permissions
  become: yes
  file:
    path: "/usr/bin/zaccess"
    owner: root
    group: root
    mode: "0755"

- block:
  - name: Ensure autostart directory exists
    file:
      dest: "{{ lookup('env','HOME') }}/.config/autostart"
      state: directory
      mode: "0700"

  - name: Disable gnome keyring agent
    copy:
      src: gnome-keyring-ssh.desktop
      dest: "{{ lookup('env','HOME') }}/.config/autostart/gnome-keyring-ssh.desktop"

  - name: Enable ssh agent
    copy:
      src: ssh-agent.desktop
      dest: "{{ lookup('env','HOME') }}/.config/autostart/ssh-agent.desktop"
