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 # common_cron_service_name: cron.service
# common_timezone: Etc/UTC
timezone: UTC # common_locale: C.UTF-8
# common_apt_update_cache: true
# vim:ft=yaml.ansible: # common_apt_cache_valid_time: 3600

View File

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

View File

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

View File

@ -24,12 +24,17 @@
- tasks - tasks
- name: set hostname - name: set hostname
hostname: ansible.builtin.hostname:
name: "{{ hostname | default(inventory_hostname) }}" name: "{{ common_hostname | default(inventory_hostname) }}"
- name: configure system timezone - name: configure system timezone
timezone: ansible.builtin.timezone:
name: "{{ timezone }}" name: "{{ common_timezone | default('Etc/UTC') }}"
notify: restart cron 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: # vim:ft=yaml.ansible: