win_ansible_role_obs_setup/tasks/powerplan.yml

25 lines
939 B
YAML
Raw Permalink Normal View History

2022-01-02 16:33:29 +01:00
---
2022-12-28 17:29:41 +01:00
- name: Change the power plan to high performance
2022-01-02 16:33:29 +01:00
community.windows.win_power_plan:
2022-02-13 04:43:09 +01:00
name: "{{ win_obs_init_powerplan_mode }}"
2022-02-16 23:00:33 +01:00
2022-12-28 17:29:41 +01:00
- name: "Apply custom powerplan poweshell script as {{ win_obs_init__user }}"
2022-02-16 23:00:33 +01:00
ansible.windows.win_powershell:
script: |
Write-Host "Disabling Screensaver"
Set-ItemProperty "HKCU:\Control Panel\Desktop" -Name ScreenSaveActive -Value 0 -Type DWord
& powercfg -x -monitor-timeout-ac 0
& powercfg -x -monitor-timeout-dc 0
& powercfg -x standby-timeout-ac 0
& powercfg -x standby-timeout-dc 0
& powercfg -x hibernate-timeout-ac 0
& powercfg -x hibernate-timeout-dc 0
& powercfg -x disk-timeout-ac 0
& powercfg -x disk-timeout-dc 0
become: true
2023-09-17 14:21:00 +02:00
become_method: ansible.builtin.runas
2022-02-16 23:00:33 +01:00
become_user: "{{ win_obs_init__user }}"
vars:
ansible_become_pass: '{{ win_obs_init__password }}'
2022-12-29 18:38:07 +01:00
changed_when: _user.changed