---
- name: Create config directory
  file:
    path: ~/.config/castero
    state: directory
    mode: 0755

- name: Copy podcast list
  copy:
    src: podcasts.opml
    dest: ~/.config/castero/podcasts.opml
    force: yes
    mode: 0644

- name: Copy config
  template:
    src: castero.j2
    dest: ~/.config/castero/castero.conf
    force: yes
    mode: 0644

- name: Check whether castero is installed
  command: which castero
  register: castero_check
  failed_when: no
  changed_when: no

- name: Import the list of podcasts
  command: castero --import ~/.config/castero/podcasts.opml
  when: castero_check.rc == 0
