NTP/ansible/configure-server.yml

89 lines
1.7 KiB
YAML
Raw Normal View History

---
- hosts: pi
gather_facts: no
tasks:
## LCD STUFF
- name: Enable i2c on boot/config.txt
lineinfile:
dest: /boot/config.txt
regexp: "^#?dtparam=i2c_arm="
line: "dtparam=i2c_arm=on"
insertafter: EOF
state: present
- name: Enable i2c module
lineinfile:
dest: /etc/modules-load.d/raspberrypi.conf
regexp: "^#?i2c"
line: "i2c-dev"
insertafter: EOF
state: present
- name: Copy systemd unit files
ansible.builtin.copy:
src: files/display.service
dest: /etc/systemd/system/
owner: root
group: root
mode: 0644
register: display_service
tags: display
- name: Reload systemd
ansible.builtin.systemd:
daemon_reload: yes
when: display_service.changed
tags: display
- name: Enable display service
ansible.builtin.systemd:
name: display
enabled: yes
state: started
tags: display
## Now the most important part: PPS
- name: Add PPS tools
package:
name: pps-tools
state: present
- name: PPS on GPIO
lineinfile:
dest: /boot/config.txt
regexp: "^dtoverlay=pps-gpio"
line: "dtoverlay=pps-gpio,gpiopin=18"
state: present
- hosts: all
tasks:
# - name: Install chrony
# package:
# name: chrony
# state: present
# notify: restart chrony
- name: Configure chrony
template:
src: files/chrony.conf.j2
dest: /etc/chrony.conf
owner: root
group: root
mode: 0644
notify: restart chrony
- name: Enable chrony
service:
name: chronyd
enabled: yes
state: started
handlers:
- name: restart chrony
service:
name: chronyd
state: restarted