Add the rest of the common role
This commit is contained in:
parent
ddad3dc65d
commit
bd6c3d307a
8
roles/common/defaults/main.yaml
Normal file
8
roles/common/defaults/main.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
cron_service_name: cron
|
||||||
|
|
||||||
|
resolv_nameserver: []
|
||||||
|
resolv_options:
|
||||||
|
- edns0
|
||||||
|
|
||||||
|
timezone: UTC
|
12
roles/common/handlers/main.yaml
Normal file
12
roles/common/handlers/main.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
- name: "restart resolv"
|
||||||
|
service:
|
||||||
|
name: "{{ resolv_service_name }}"
|
||||||
|
state: restarted
|
||||||
|
when: resolv_service_name is defined
|
||||||
|
|
||||||
|
- name: restart cron
|
||||||
|
service:
|
||||||
|
name: "{{ cron_service_name }}"
|
||||||
|
state: restarted
|
||||||
|
when: cron_service_name is defined
|
@ -1,6 +1,24 @@
|
|||||||
---
|
---
|
||||||
|
- name: gather OS specific variables
|
||||||
|
include_vars: "{{ item }} "
|
||||||
|
with_first_found:
|
||||||
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
||||||
|
- "{{ ansible_distribution }}.yaml"
|
||||||
|
- "{{ ansible_os_family }}.yaml"
|
||||||
|
|
||||||
- name: install system utilities
|
- name: install system utilities
|
||||||
package:
|
package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
with_items: "{{ sys_utils }}"
|
with_items: "{{ sys_utils }}"
|
||||||
|
|
||||||
|
- name: configure resolv.conf
|
||||||
|
template:
|
||||||
|
src: resolv.conf.j2
|
||||||
|
dest: /etc/resolv.conf
|
||||||
|
notify: "restart resolv"
|
||||||
|
|
||||||
|
- name: configure system timezone
|
||||||
|
timezone:
|
||||||
|
name: "{{ timezone }}"
|
||||||
|
notify: restart cron
|
||||||
|
8
roles/common/templates/resolv.conf.j2
Normal file
8
roles/common/templates/resolv.conf.j2
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
{% for ns in resolv_nameserver %}
|
||||||
|
nameserver {{ ns }}
|
||||||
|
{% endfor %}
|
||||||
|
{% if resolv_options is defined %}
|
||||||
|
options {{ resolv_options | join(' ') }}
|
||||||
|
{% endif %}
|
2
roles/common/vars/Ubuntu-18.yaml
Normal file
2
roles/common/vars/Ubuntu-18.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
resolv_service_name: systemd-resolved.service
|
Loading…
Reference in New Issue
Block a user