---
- name: install common packages
  yum: name={{ item }} state=present
  with_items:
    - "{{ v_yum_common_packages }}"
  tags:
    - yum

- name: configure yum-cron
  template: src=yum-cron.conf.j2
    dest={{ v_yum_cron_config }}
    backup=yes
    owner=0 group=0 mode=0644
  notify:
    - restart yum-cron
  tags:
    - yum

---
- name: install core yum packages from base
  yum: name={{ item }} state=present enablerepo="base,updates" disablerepo="*" update_cache=yes
  with_items:
    - yum-plugin-fastestmirror
    - yum-utils
  tags:
    - yum

- name: install core yum packages from extras
  yum: name={{ item }} state=present enablerepo="extras,updates" disablerepo="*" update_cache=yes
  with_items:
    - epel-release
  tags:
    - yum

- name: disable all repos
  command: yum-config-manager --disable "*"
  tags:
    - yum

- name: enable specific repos
  command: yum-config-manager --enable {{ item }}
  with_items:
    - base
    - epel
    - extras
    - updates
  tags:
    - yum

- name: install common packages
  yum: name={{ item }} state=present update_cache=yes
  with_items:
    - "{{ v_yum_common_packages }}"
  tags:
    - yum

- name: configure yum-cron
  template: src=yum-cron.conf.j2
    dest={{ v_yum_cron_config }}
    backup=yes
    owner=0 group=0 mode=0644
  notify:
    - restart yum-cron
  tags:
    - yum

Enable "core" yum packaged (fast mirrors, epel etc). Disable all repos and then enable only those specified.
Enable "core" yum packaged (fast mirrors, epel etc).
Disable all repos and then enable only those specified.
