---

- name: Evolix embedded GPG key is absent
  apt_key:
    id: "B8612B5D"
    keyring: /etc/apt/trusted.gpg
    state: absent
  tags:
    - apt

- name: Add Evolix GPG key
  copy:
    src: reg.asc
    dest: /etc/apt/trusted.gpg.d/reg.asc
    force: yes
    mode: "0644"
    owner: root
    group: root
  tags:
    - apt

- name: Evolix public list is installed
  template:
    src: evolix_public.list.j2
    dest: /etc/apt/sources.list.d/evolix_public.list
    force: yes
    mode: "0640"
  register: apt_evolix_public
  tags:
    - apt

- name: Apt update
  apt:
    update_cache: yes
  when: apt_evolix_public is changed
  tags:
    - apt
