- name: Import nginx signing key
  become: yes
  rpm_key:
    key: https://nginx.org/keys/nginx_signing.key
    state: present

- name: Add nginx stable repo
  become: yes
  copy:
    dest: /etc/yum.repos.d/nginx-stable.repo
    owner: root
    group: root
    mode: '0644'
    content: |
        [nginx-stable]
        name=nginx stable repo
        baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
        gpgcheck=1
        enabled=1
        gpgkey=https://nginx.org/keys/nginx_signing.key
        module_hotfixes=true

- name: Update yum cache
  become: yes
  yum:
    state: present
    update_cache: yes
