---
# default is etc/utc in build 20141129 [http://cloud.centos.org/centos/7/images/]
- name: set timezone to etc/utc
  sudo: yes
  file:
    src: /usr/share/zoneinfo/Etc/UTC
    dest: /etc/localtime
    state: link
    force: yes
  tags:
    - common

# add hosts to /etc/hosts
- name: configure hosts file
  sudo: yes
  lineinfile:
    dest: /etc/hosts
    regexp: "^{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}{% if use_host_domain %} {{ item }}.{{ host_domain }}{% endif %}$"
    line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}{% if use_host_domain %} {{ item }}.{{ host_domain}}{% endif %}"
    state: present
  when: hostvars[item].ansible_default_ipv4.address is defined
  with_items: groups['all']
  tags:
    - common

- name: enable EPEL repo
  sudo: yes
  yum:
    name: epel-release
    state: latest
  tags:
    - common

- name: bootstrap virt7-testing repo
  copy:
    src: virt7-testing.repo
    dest: /etc/yum.repos.d/
    owner: root
    group: root
    mode: 0644
  tags:
    - common

---
# default is etc/utc in build 20141129 [http://cloud.centos.org/centos/7/images/]
- name: set timezone to etc/utc
  sudo: yes
  file:
    src: /usr/share/zoneinfo/Etc/UTC
    dest: /etc/localtime
    state: link
    force: yes
  tags:
    - common

- name: Check if selinux enforcing
  sudo: yes
  command: getenforce
  register: selinux
  changed_when: false
  tags:
    - common

- name: Set selinux permissive because tokens and selinux don't work together
  sudo: yes
  selinux: state=permissive policy=targeted
  when: "'Enforcing' in selinux.stdout"
  tags:
    - common

# add hosts to /etc/hosts
- name: configure hosts file
  sudo: yes
  lineinfile:
    dest: /etc/hosts
    regexp: "^{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}{% if use_host_domain %} {{ item }}.{{ host_domain }}{% endif %}$"
    line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}{% if use_host_domain %} {{ item }}.{{ host_domain}}{% endif %}"
    state: present
  when: hostvars[item].ansible_default_ipv4.address is defined
  with_items: groups['all']
  tags:
    - common

- name: enable EPEL repo
  sudo: yes
  yum:
    name: epel-release
    state: latest
  tags:
    - common

Change SELinux to permissive mode
Change SELinux to permissive mode
