common: refactor

This commit is contained in:
Ryan Cavicchioni 2022-09-01 17:12:52 -05:00
parent 4b581b8a78
commit 42ba49c865
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
4 changed files with 19 additions and 17 deletions

View File

@ -1,6 +1,6 @@
---
cron_service_name: cron
timezone: UTC
# vim:ft=yaml.ansible:
# common_cron_service_name: cron.service
# common_timezone: Etc/UTC
# common_locale: C.UTF-8
# common_apt_update_cache: true
# common_apt_cache_valid_time: 3600

View File

@ -1,8 +1,5 @@
---
- name: restart cron
service:
name: "{{ cron_service_name }}"
ansible.builtin.service:
name: "{{ common_cron_service_name | default('cron.service') }}"
state: restarted
when: cron_service_name is defined
# vim:ft=yaml.ansible:

View File

@ -1,6 +1,6 @@
---
- name: run apt-get update
apt:
update_cache: yes
cache_valid_time: 3600
ansible.builtin.apt:
update_cache: "{{ common_apt_update_cache | default(true) }}"
cache_valid_time: "{{ common_apt_cache_valid_time | default(3600) }}"
changed_when: false

View File

@ -24,12 +24,17 @@
- tasks
- name: set hostname
hostname:
name: "{{ hostname | default(inventory_hostname) }}"
ansible.builtin.hostname:
name: "{{ common_hostname | default(inventory_hostname) }}"
- name: configure system timezone
timezone:
name: "{{ timezone }}"
ansible.builtin.timezone:
name: "{{ common_timezone | default('Etc/UTC') }}"
notify: restart cron
- name: configure system locale
ansible.builtin.command:
cmd: "localectl set-locale {{ common_locale | default('C.UTF-8') }}"
when: ansible_facts.env.LANG != (common_locale | default('C.UTF-8'))
# vim:ft=yaml.ansible: