Skip to content

Commit

Permalink
Enable VM to edit resolv.conf per Issue rhtconsulting#198
Browse files Browse the repository at this point in the history
This adds become: yes to the play run on localhost to edit resolv.conf.
On a container this works without become but on a VM this requires sudo access.
Enabling sudo on a container should not have a negative affect. This can
also be accomplished by setting the variable ansible_sudo: true but that
is a per-role or per-task setting, where become is per-play.
  • Loading branch information
vvaldez committed Jun 29, 2016
1 parent 5fd360e commit 306fa66
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rhc-ose-ansible/ose-provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@

# Use newly configured DNS server for this container ...
- hosts: localhost
become: yes
tasks:
- name: "Edit /etc/resolv.conf in container"
shell: "sed '0,/.*nameserver.*/s/.*nameserver.*/nameserver {%for host in groups['dns']%}{{ hostvars[host].dns_public_ip }}{% endfor %}\\n&/' /etc/resolv.conf > /tmp/resolv.conf && /bin/cp -f /tmp/resolv.conf /etc/resolv.conf"
Expand Down

0 comments on commit 306fa66

Please sign in to comment.