1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_resolvconf.git synced 2024-08-16 10:09:52 +02:00
ansible_role_resolvconf/tasks/main.yml

49 lines
1.2 KiB
YAML
Raw Normal View History

2021-03-04 15:37:38 +01:00
---
2021-03-08 11:47:30 +01:00
- name: run versionscheck
ansible.builtin.include_tasks: versioncheck.yml
2021-03-04 15:37:38 +01:00
when: submodules_versioncheck|bool
2021-03-04 15:58:39 +01:00
- name: resolv.conf is ino longer immutable.
become: true
ansible.builtin.file:
path: '/etc/resolv.conf'
attr: '-i'
register: resolv_file
2021-03-04 16:07:53 +01:00
changed_when: "resolv_file.changed and not resolveconf__immutable"
ignore_errors: true
2021-03-04 15:58:39 +01:00
2021-03-08 11:47:30 +01:00
- name: deploy resolv.conf
block:
- name: "Configure resolv.conf"
become: true
ansible.builtin.template:
src: 'templates/resolv.conf.j2'
dest: '/etc/resolv.conf'
mode: "{{ resolvconf__mode }}"
owner: root
group: root
rescue:
- name: Remove /etc/resolv.conf
become: true
ansible.builtin.file:
path: '/etc/resolv.conf'
state: absent
- name: "try to deplpy resolv.conf again"
become: true
ansible.builtin.template:
src: 'templates/resolv.conf.j2'
dest: '/etc/resolv.conf'
mode: "{{ resolvconf__mode }}"
owner: root
group: root
2021-03-04 15:58:39 +01:00
- name: Ensure resolv.conf is immutable.
become: true
ansible.builtin.file:
path: '/etc/resolv.conf'
attr: '+i'
register: resolv_file
2021-03-04 16:07:53 +01:00
changed_when: "not resolv_file.changed"
2021-03-04 15:58:39 +01:00
when: resolveconf__immutable | bool