---
#
# Browbeat Install Common
#

- name: Check for DNS record
  command: grep "{{ dns_server }}" /etc/resolv.conf
  register: dns_record
  failed_when: false
  changed_when: false

- name: Add DNS record
  shell: echo "nameserver {{ dns_server }}" | tee -a /etc/resolv.conf
  when: dns_record.rc == 1

- name: Get rhel repo file from director
  fetch: src=/etc/yum.repos.d/"{{ repo_name }}" dest=roles/common/files/rhel.repo flat=yes
  when: director
  changed_when: false

- name: Copy rhel repo file to controllers/computes
  copy: src=rhel.repo dest=/etc/yum.repos.d/
  when: not director

---
#
# Browbeat Install Common
#

- name: Add DNS record
  lineinfile: dest=/etc/resolv.conf state=present line="nameserver {{ dns_server }}" insertafter="^search"

- name: Get rhel repo file from director
  fetch: src=/etc/yum.repos.d/"{{ repo_name }}" dest=roles/common/files/rhel.repo flat=yes
  when: director
  changed_when: false

- name: Copy rhel repo file to controllers/computes
  copy: src=rhel.repo dest=/etc/yum.repos.d/
  when: not director

Reduce ansible tasks for dns server add.
Reduce ansible tasks for dns server add.

Change-Id: Ib2e38fef15204eaca11efba4d4f6b50ddea1f87c
