diff --git a/roles/driver-msi-keyboard-color/tasks/main.yml b/roles/driver-msi-keyboard-color/tasks/main.yml index 0d76aa84..50b79f7e 100644 --- a/roles/driver-msi-keyboard-color/tasks/main.yml +++ b/roles/driver-msi-keyboard-color/tasks/main.yml @@ -5,5 +5,29 @@ name: - msi-perkeyrgb -- include_tasks: setup_script.yml -- include_tasks: setup_timers.yml +- name: Copy keyboard_color.sh script + copy: + src: keyboard_color.py + dest: /opt/keyboard_color.py + mode: 0755 + +- name: Copy keyboard-color.cymais.service file + template: + src: keyboard-color.service.j2 + dest: /etc/systemd/system/keyboard-color.cymais.service + mode: 0644 + +- name: Reload systemd daemon + systemd: + daemon_reload: yes + +- name: set service_name to the name of the current role + set_fact: + service_name: "{{ role_name }}" + +- name: "include role for systemd-timer for {{service_name}}" + include_role: + name: systemd-timer + vars: + on_calendar: "{{on_calendar_msi_keyboard_color}}" + persistent: "true" diff --git a/roles/driver-msi-keyboard-color/tasks/setup_script.yml b/roles/driver-msi-keyboard-color/tasks/setup_script.yml deleted file mode 100644 index a0888f6d..00000000 --- a/roles/driver-msi-keyboard-color/tasks/setup_script.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Copy keyboard_color.sh script - copy: - src: keyboard_color.py - dest: /opt/keyboard_color.py - mode: 0755 - tags: - - keyboard-color diff --git a/roles/driver-msi-keyboard-color/tasks/setup_timers.yml b/roles/driver-msi-keyboard-color/tasks/setup_timers.yml deleted file mode 100644 index 1be67b04..00000000 --- a/roles/driver-msi-keyboard-color/tasks/setup_timers.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- name: Copy keyboard-color.cymais.timer file - template: - src: keyboard-color.timer.j2 - dest: /etc/systemd/system/keyboard-color.cymais.timer - mode: 0644 - tags: - - keyboard-color - -- name: Copy keyboard-color.cymais.service file - template: - src: keyboard-color.service.j2 - dest: /etc/systemd/system/keyboard-color.cymais.service - mode: 0644 - tags: - - keyboard-color - -- name: Reload systemd daemon - systemd: - daemon_reload: yes - tags: - - keyboard-color - -- name: Enable and start keyboard-color.cymais.timer - systemd: - name: keyboard-color.cymais.timer - state: restarted - enabled: yes - tags: - - keyboard-color diff --git a/roles/driver-msi-keyboard-color/templates/keyboard-color.timer.j2 b/roles/driver-msi-keyboard-color/templates/keyboard-color.timer.j2 deleted file mode 100644 index 91cbdcdd..00000000 --- a/roles/driver-msi-keyboard-color/templates/keyboard-color.timer.j2 +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Keyboard Color Timer - -[Timer] -OnCalendar={{on_calendar_msi_keyboard_color}} -Persistent=true - -[Install] -WantedBy=timers.target