- name: install required packages for script [Ubuntu] become: yes apt: update_cache: yes pkg: - linux-tools-common - linux-tools-generic when: ansible_distribution == "Ubuntu" - name: install required packages for script [Arch] become: yes community.general.pacman: name: - cpupower when: ansible_distribution == "Archlinux" - name: copy scripts become: yes copy: src: "usr/local/sbin/{{item}}" dest: "/usr/local/sbin/{{item}}" mode: '0755' loop: - power-saver-mode - unlimited-power - name: add udev rules become: yes copy: src: etc/udev/rules.d/99-powersave.rules dest: /etc/udev/rules.d/99-powersave.rules mode: '0755' - name: 'reload udev rules' become: yes shell: cmd: | udevadm control --reload udevadm trigger