7516fe142f
* Ansible: move to Ansible 3.4.0 which uses ansible-base 2.10.10 * Docs: add a note about ansible upgrade post 2.9.x * CI: ensure ansible is removed before ansible 3.x is installed to avoid pip failures * Ansible: use newer ansible-lint * Fix ansible-lint 5.0.11 found issues * syntax issues * risky-file-permissions * var-naming * role-name * molecule tests * Mitogen: use 0.3.0rc1 which adds support for ansible 2.10+ * Pin ansible-base to 2.10.11 to get package fix on RHEL8
60 lines
2 KiB
YAML
60 lines
2 KiB
YAML
---
|
|
- name: create temporary resolveconf cloud init file
|
|
command: cp -f /etc/resolv.conf "{{ resolvconffile }}"
|
|
when: ansible_os_family in ["Flatcar Container Linux by Kinvolk"]
|
|
|
|
- name: Add domain/search/nameservers/options to resolv.conf
|
|
blockinfile:
|
|
path: "{{ resolvconffile }}"
|
|
block: |-
|
|
{% for item in [domainentry] + [searchentries] + nameserverentries.split(',') -%}
|
|
{{ item }}
|
|
{% endfor %}
|
|
options ndots:{{ ndots }}
|
|
options timeout:2
|
|
options attempts:2
|
|
state: present
|
|
insertbefore: BOF
|
|
create: yes
|
|
backup: yes
|
|
marker: "# Ansible entries {mark}"
|
|
mode: 0644
|
|
notify: Preinstall | propagate resolvconf to k8s components
|
|
|
|
- name: Remove search/domain/nameserver options before block
|
|
replace:
|
|
dest: "{{ item[0] }}"
|
|
regexp: '^{{ item[1] }}[^#]*(?=# Ansible entries BEGIN)'
|
|
backup: yes
|
|
follow: yes
|
|
with_nested:
|
|
- "{{ [resolvconffile, base|default(''), head|default('')] | difference(['']) }}"
|
|
- [ 'search ', 'nameserver ', 'domain ', 'options ' ]
|
|
notify: Preinstall | propagate resolvconf to k8s components
|
|
|
|
- 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('')] | difference(['']) }}"
|
|
- [ 'search ', 'nameserver ', 'domain ', 'options ' ]
|
|
notify: Preinstall | propagate resolvconf to k8s components
|
|
|
|
|
|
- name: get temporary resolveconf cloud init file content
|
|
command: cat {{ resolvconffile }}
|
|
register: cloud_config
|
|
when: ansible_os_family in ["Flatcar Container Linux by Kinvolk"]
|
|
|
|
- name: persist resolvconf cloud init file
|
|
template:
|
|
dest: "{{ resolveconf_cloud_init_conf }}"
|
|
src: resolvconf.j2
|
|
owner: root
|
|
mode: 0644
|
|
notify: Preinstall | update resolvconf for Flatcar Container Linux by Kinvolk
|
|
when: ansible_os_family in ["Flatcar Container Linux by Kinvolk"]
|