---
- name: create install dir
  file: path=/opt/pcloud state=directory
  become: true
- name: get JSON from API
  uri: url=https://api.pcloud.com/getpublinkdownload?code=XZGr337ZAdsin51iTdSc2MVwD7bHzbMenjok method=GET return_content=yes
  register: json_response
- name: set download URL
  set_fact: download_url="https://{{ json_response.json.hosts[0] }}{{ json_response.json.path }}"
- name: download pCloud
  get_url: dest="/opt/pcloud/pcloud" url="{{ download_url }}"
  become: true
- name: make pCloud application executable
  file: dest="/opt/pcloud/pcloud" mode=a+x
  become: true
- name: set pCloud to autostart
  copy: src=pcloud.desktop dest="~/.config/autostart" mode=0644

---
- name: create install dir
  file: path=/opt/pcloud state=directory
  become: true
- name: get JSON from API
  uri: url=https://api.pcloud.com/getpublinkdownload?code=XZGr337ZAdsin51iTdSc2MVwD7bHzbMenjok method=GET return_content=yes
  register: json_response
- name: set download URL
  set_fact: download_url="https://{{ json_response.json.hosts[0] }}{{ json_response.json.path }}"
- name: download pCloud
  get_url: dest="/opt/pcloud/pcloud" url="{{ download_url }}"
  become: true
- name: make pCloud application executable
  file: dest="/opt/pcloud/pcloud" mode=a+x
  become: true
- name: ensure autostart directory exists
  file: path=~/.config/autostart state=directory mode=0700
- name: add autostart file for pCloud
  copy: src=pcloud.desktop dest="~/.config/autostart/pcloud.desktop" mode=0644

Fix issues with pCloud autostart config
Fix issues with pCloud autostart config
