---
# Fixes "Failure talking to yum: Cannot retrieve repository metadata (repomd.xml) for repository: StackStorm_stable. Please verify its path and try again" when installing st2
- name: Update ca-certificates package
  become: yes
  yum:
    name: ca-certificates
    state: latest
  tags: skip_ansible_lint

- name: Add StackStorm repo
  become: yes
  yum_repository:
    name: "StackStorm_{{ st2_pkg_repo }}"
    description: "StackStorm_{{ st2_pkg_repo }}"
    file: "StackStorm_{{ st2_pkg_repo }}"
    baseurl: https://packagecloud.io/StackStorm/{{ st2_pkg_repo }}/el/{{ ansible_distribution_major_version }}/$basearch
    repo_gpgcheck: yes
    gpgkey: "https://packagecloud.io/StackStorm/{{ st2_pkg_repo }}/gpgkey"
    sslcacert: /etc/pki/tls/certs/ca-bundle.crt
    metadata_expire: 300
    gpgcheck: no
    enabled: yes
    sslverify: yes
  register: st2_repo_installed

---
# Fixes "Failure talking to yum: Cannot retrieve repository metadata (repomd.xml) for repository: StackStorm_stable. Please verify its path and try again" when installing st2
- name: Update ca-certificates package
  become: yes
  yum:
    name: ca-certificates
    state: latest
  tags: skip_ansible_lint

# See: https://github.com/docker-library/docs/tree/master/centos#package-documentation
# We ship `nginx.conf` via `st2` package doc files, for example
- name: Enable shipping package documentation files for EL
  become: yes
  ini_file:
    dest: /etc/yum.conf
    section: main
    option: tsflags
    value: nodocs
    state: absent
  when: ansible_os_family == "RedHat"

- name: Add StackStorm repo
  become: yes
  yum_repository:
    name: "StackStorm_{{ st2_pkg_repo }}"
    description: "StackStorm_{{ st2_pkg_repo }}"
    file: "StackStorm_{{ st2_pkg_repo }}"
    baseurl: https://packagecloud.io/StackStorm/{{ st2_pkg_repo }}/el/{{ ansible_distribution_major_version }}/$basearch
    repo_gpgcheck: yes
    gpgkey: "https://packagecloud.io/StackStorm/{{ st2_pkg_repo }}/gpgkey"
    sslcacert: /etc/pki/tls/certs/ca-bundle.crt
    metadata_expire: 300
    gpgcheck: no
    enabled: yes
    sslverify: yes
  register: st2_repo_installed

Fix nginx.conf is not shipped via st2 doc files under EL
Fix nginx.conf is not shipped via st2 doc files under EL

Original error:
```
cp: cannot stat ‘/usr/share/doc/st2/conf/nginx/st2.conf’: No such file or directory
```
