- name: Disable auto-updates on Pouta
  file: name=/etc/cron.daily/automatic_updates state=absent

# fixes for centos 7.6 image, roll everything back to 7.5
- name: Move existing yum repo
  command: mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back

- name: optionally lock operating system minor version in repo config
  yum_repository:
    name: "{{ item.name }}"
    baseurl: "http://vault.centos.org/7.5.1804/{{ item.subpath }}/$basearch/"
    description: "CentOS-7.5 - {{ item.name }}"
    enabled: "{{ item.enabled }}"
    gpgcheck: yes
    gpgkey: "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7"
  with_items:
    - name: 'base'
      subpath: 'os'
      enabled: "{{ (lock_os_minor_version|default(true)|bool) | ternary('1', '0') }}"
    - name: 'updates'
      subpath: 'updates'
      enabled: "{{ (lock_os_minor_version|default(true)|bool) | ternary('1', '0') }}"
    - name: 'extras'
      subpath: 'extras'
      enabled: "{{ (lock_os_minor_version|default(true)|bool) | ternary('1', '0') }}"
    - name: 'centosplus'
      subpath: 'centosplus'
      enabled: no
  register: create_locked_yum_repo_configs


- name: Disable auto-updates on Pouta
  file: name=/etc/cron.daily/automatic_updates state=absent

# fixes for centos 7.6 image, roll everything back to 7.5
- name: optionally lock operating system minor version in repo config
  yum_repository:
    name: "{{ item.name }}"
    baseurl: "http://vault.centos.org/7.5.1804/{{ item.subpath }}/$basearch/"
    description: "CentOS-7.5 - {{ item.name }}"
    enabled: "{{ item.enabled }}"
    gpgcheck: yes
    gpgkey: "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7"
  with_items:
    - name: 'base'
      subpath: 'os'
      enabled: "{{ (lock_os_minor_version|default(true)|bool) | ternary('1', '0') }}"
    - name: 'updates'
      subpath: 'updates'
      enabled: "{{ (lock_os_minor_version|default(true)|bool) | ternary('1', '0') }}"
    - name: 'extras'
      subpath: 'extras'
      enabled: "{{ (lock_os_minor_version|default(true)|bool) | ternary('1', '0') }}"
    - name: 'centosplus'
      subpath: 'centosplus'
      enabled: no
  register: create_locked_yum_repo_configs


Rectify error when centos base repo is not present in pool_vms.
Rectify error when centos base repo is not present in pool_vms.
