- name: Download PPA signing key
  become: true
  apt_key:
    keyserver: keyserver.ubuntu.com
    id: 6CEB6050A30E5769
    keyring: /etc/apt/trusted.gpg.d/nicotine.gpg
- name: Install PPA repository
  become: true
  apt_repository:
    repo: "deb [signed-by=/etc/apt/trusted.gpg.d/nicotine.gpg] https://ppa.launchpadcontent.net/nicotine-team/stable/ubuntu {{ distribution_release }} main"
  register: apt_repository
- name: Update APT cache
  become: true
  apt:
    update_cache: true
  when: apt_repository.changed
- name: Install nicotine
  become: true
  apt:
    name: nicotine
- name: Create configuration directory
  file:
    path: ~/.config/nicotine
    recurse: true
    state: directory
- name: Copy configuration file
  template:
    src: "{{ role_path }}/templates/config.j2"
    dest: ~/.config/nicotine/config