infra/ansible/roles/common/tasks/main.yml
surtur d89101b437
chore: add changes
- mv common vault to group_vars/all/vault_common.yml
- conclude timesyncing setup
- enable cronie/chrony for systems
- set up dnscrypt properly, including replacing /etc/resolv.conf and
  validating the config
- fix privileges (become)
2023-07-24 17:16:33 +02:00

56 lines
1.3 KiB
YAML

---
- include_tasks: hostname.yml
- include_tasks: pkg.yml
- name: Start and enable systemd-timesyncd
become: true
systemd:
name: systemd-timesyncd
state: started
enabled: true
- name: Set timezone
become: true
# ansible.builtin.shell: "timedatectl set-timezone {{ timezone }}"
community.general.timezone:
name: "{{ timezone }}"
register: tz
- name: Enable NTP
become: true
ansible.builtin.shell: timedatectl set-ntp true
register: ntp
- name: Start and enable cronie
become: true
ansible.builtin.systemd:
name: cronie
state: started
enabled: true
when: ansible_distribution == "Archlinux"
- name: Start and enable chronyd
become: true
ansible.builtin.systemd:
name: chronyd
state: started
enabled: true
when: ansible_distribution == "Fedora"
- name: Restart cronie if time settings changed
become: true
ansible.builtin.systemd:
name: cronie
state: restarted
when: ansible_distribution == "Archlinux" and (tz is changed or ntp is changed)
- name: Restart chronyd if time settings changed
become: true
ansible.builtin.systemd:
name: chronyd
state: restarted
when: ansible_distribution == "Fedora" and (tz is changed or ntp is changed)
- include_tasks: dnscrypt.yml
when: ansible_hostname == "nbgw"