---
# tasks file for st2repos

- name: Install prereqs
  become: yes
  apt:
    name: "{{ item }}"
    state: present
    update_cache: yes
  with_items:
    - debian-archive-keyring
    - apt-transport-https
  
- name: Add keys to keyring
  become: yes
  apt_key:
    url: https://packagecloud.io/StackStorm/{{ st2_pkg_repo }}/gpgkey
    state: present

- name: Add StackStorm repos
  become: yes
  apt_repository:
    repo: 'deb https://packagecloud.io/StackStorm/{{ st2_pkg_repo }}/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release|lower }} main'
    state: present
    update_cache: yes

---
- name: Install prereqs
  become: yes
  apt:
    name: "{{ item }}"
    state: present
  with_items:
    - debian-archive-keyring
    - apt-transport-https
  
- name: Add keys to keyring
  become: yes
  apt_key:
    url: https://packagecloud.io/StackStorm/{{ st2_pkg_repo }}/gpgkey
    state: present

- name: Add StackStorm repos
  become: yes
  apt_repository:
    repo: 'deb https://packagecloud.io/StackStorm/{{ st2_pkg_repo }}/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release|lower }} main'
    state: present
    update_cache: yes

Remove update_cache for "Install prereqs" step
Remove update_cache for "Install prereqs" step
