|
@ -3,25 +3,16 @@ |
|
|
command: cp -f /etc/resolv.conf "{{ resolvconffile }}" |
|
|
command: cp -f /etc/resolv.conf "{{ resolvconffile }}" |
|
|
when: ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] |
|
|
when: ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] |
|
|
|
|
|
|
|
|
- name: Remove search/domain/nameserver options |
|
|
|
|
|
lineinfile: |
|
|
|
|
|
dest: "{{item[0]}}" |
|
|
|
|
|
state: absent |
|
|
|
|
|
regexp: "^{{ item[1] }}.*$" |
|
|
|
|
|
backup: yes |
|
|
|
|
|
follow: yes |
|
|
|
|
|
with_nested: |
|
|
|
|
|
- "{{ [resolvconffile] + [base|default('')] + [head|default('')] }}" |
|
|
|
|
|
- [ 'search ', 'nameserver ', 'domain ', 'options ' ] |
|
|
|
|
|
notify: Preinstall | restart network |
|
|
|
|
|
|
|
|
|
|
|
- name: Add domain/search/nameservers to resolv.conf |
|
|
|
|
|
|
|
|
- name: Add domain/search/nameservers/options to resolv.conf |
|
|
blockinfile: |
|
|
blockinfile: |
|
|
dest: "{{resolvconffile}}" |
|
|
dest: "{{resolvconffile}}" |
|
|
block: |- |
|
|
block: |- |
|
|
{% for item in [domainentry] + [searchentries] + nameserverentries.split(',') -%} |
|
|
{% for item in [domainentry] + [searchentries] + nameserverentries.split(',') -%} |
|
|
{{ item }} |
|
|
{{ item }} |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
|
|
|
options ndots:{{ ndots }} |
|
|
|
|
|
options timeout:2 |
|
|
|
|
|
options attempts:2 |
|
|
state: present |
|
|
state: present |
|
|
insertbefore: BOF |
|
|
insertbefore: BOF |
|
|
create: yes |
|
|
create: yes |
|
@ -30,21 +21,32 @@ |
|
|
marker: "# Ansible entries {mark}" |
|
|
marker: "# Ansible entries {mark}" |
|
|
notify: Preinstall | restart network |
|
|
notify: Preinstall | restart network |
|
|
|
|
|
|
|
|
- name: Add options to resolv.conf |
|
|
|
|
|
lineinfile: |
|
|
|
|
|
line: options {{ item }} |
|
|
|
|
|
dest: "{{resolvconffile}}" |
|
|
|
|
|
state: present |
|
|
|
|
|
regexp: "^options.*{{ item }}$" |
|
|
|
|
|
insertafter: EOF |
|
|
|
|
|
|
|
|
- name: Remove search/domain/nameserver options before block |
|
|
|
|
|
replace: |
|
|
|
|
|
dest: "{{item[0]}}" |
|
|
|
|
|
regexp: '^{{ item[1] }}[^#]*(?=# Ansible entries BEGIN)' |
|
|
backup: yes |
|
|
backup: yes |
|
|
follow: yes |
|
|
follow: yes |
|
|
with_items: |
|
|
|
|
|
- ndots:{{ ndots }} |
|
|
|
|
|
- timeout:2 |
|
|
|
|
|
- attempts:2 |
|
|
|
|
|
|
|
|
with_nested: |
|
|
|
|
|
- "{{ [resolvconffile] + [base|default('')] + [head|default('')] }}" |
|
|
|
|
|
- [ 'search ', 'nameserver ', 'domain ', 'options ' ] |
|
|
|
|
|
when: item[0] != "" |
|
|
notify: Preinstall | restart network |
|
|
notify: Preinstall | restart network |
|
|
|
|
|
|
|
|
|
|
|
- name: Remove search/domain/nameserver options after block |
|
|
|
|
|
replace: |
|
|
|
|
|
dest: "{{item[0]}}" |
|
|
|
|
|
regexp: '(# Ansible entries END\n(?:(?!^{{ item[1] }}).*\n)*)(?:^{{ item[1] }}.*\n?)+' |
|
|
|
|
|
replace: '\1' |
|
|
|
|
|
backup: yes |
|
|
|
|
|
follow: yes |
|
|
|
|
|
with_nested: |
|
|
|
|
|
- "{{ [resolvconffile] + [base|default('')] + [head|default('')] }}" |
|
|
|
|
|
- [ 'search ', 'nameserver ', 'domain ', 'options ' ] |
|
|
|
|
|
when: item[0] != "" |
|
|
|
|
|
notify: Preinstall | restart network |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: get temporary resolveconf cloud init file content |
|
|
- name: get temporary resolveconf cloud init file content |
|
|
command: cat {{ resolvconffile }} |
|
|
command: cat {{ resolvconffile }} |
|
|
register: cloud_config |
|
|
register: cloud_config |
|
|