diff --git a/tasks/main.yml b/tasks/main.yml index 666a752..fd47185 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,6 @@ --- -- name: validate virtuaization extentions are available to this host +- name: validate virtualization extensions are available to this host include_tasks: validate.yml - name: configure shell extras @@ -8,8 +8,13 @@ - name: ensure libvirt packages are installed shell: > - yum install -y "{{ item }}" + rpm -q "{{ item }}" || yum install -y "{{ item }}" && echo yes + args: + warn: false loop: "{{ libvirt_pkgs }}" + register: pkg_installed + changed_when: pkg_installed.stdout == 'yes' + - name: enable libvirt services service: diff --git a/tasks/networks.yml b/tasks/networks.yml index 274127a..2b29c11 100644 --- a/tasks/networks.yml +++ b/tasks/networks.yml @@ -21,6 +21,11 @@ with_items: "{{ libvirt_host_networks }}" become: True +- name: delete any previous failed attempts + file: + path: /etc/sysconfig/network-scripts/ifcfg- + state: absent + - name: setup bridge interface template: src: ifcfg_bridge_template.j2 diff --git a/templates/resolv.conf.j2 b/templates/resolv.conf.j2 index 0d8e1c4..17c7614 100644 --- a/templates/resolv.conf.j2 +++ b/templates/resolv.conf.j2 @@ -6,7 +6,11 @@ search {{ search_domains|join(' ') }} {% if vm_domain != "" %} domain {{ vm_domain }} {% endif %} +{% if idm_public_ip != "" %}} +nameserver {{ idm_public_ip }} +{% elif idm_public_ip == "" %} {% for ns in dns_servers %} nameserver {{ ns }} {% endfor %} +{% endif %} options rotate timeout:1