diff --git a/.gitmodules b/.gitmodules index 0675207..d8ecd24 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,18 @@ [submodule "collections/ansible_collections/ansible/windows"] path = collections/ansible_collections/ansible/windows url = https://github.com/ansible-collections/ansible.windows.git +[submodule "roles/l3d.sshd"] + path = roles/l3d.sshd + url = https://git.l3d.ch/voc/win_ansible_role_sshd.git +[submodule "roles/l3d.time"] + path = roles/l3d.time + url = https://git.l3d.ch/win_ansible/ansible_role_win_time.git +[submodule "roles/l3d.rdp"] + path = roles/l3d.rdp + url = https://git.l3d.ch/voc/win_ansible_role_rdp.git +[submodule "roles/l3d.icmp"] + path = roles/l3d.icmp + url = https://git.l3d.ch/voc/win_ansible_role_firewall_icmp.git +[submodule "roles/l3d.win_exporter"] + path = roles/l3d.win_exporter + url = https://git.l3d.ch/win_ansible/ansible_role_win_exporter.git diff --git a/host_vars/twr.local.yml b/host_vars/twr.local.yml index d85f383..718c11e 100644 --- a/host_vars/twr.local.yml +++ b/host_vars/twr.local.yml @@ -1 +1,2 @@ ansible_user: 'L3D' +win_hostname: 'twr' diff --git a/roles/hostname/tasks/main.yml b/roles/hostname/tasks/main.yml new file mode 100644 index 0000000..4bfc909 --- /dev/null +++ b/roles/hostname/tasks/main.yml @@ -0,0 +1,9 @@ +--- +- name: Change the hostname to {{ win_hostname | default (ansible_hostname) }} + ansible.windows.win_hostname: + name: "{{ win_hostname | default (ansible_hostname) }}" + register: res + +- name: Reboot + ansible.windows.win_reboot: + when: res.reboot_required diff --git a/roles/l3d.icmp b/roles/l3d.icmp new file mode 160000 index 0000000..b277f41 --- /dev/null +++ b/roles/l3d.icmp @@ -0,0 +1 @@ +Subproject commit b277f41d6266005140ca6cbbe1564f2bb0314873 diff --git a/roles/l3d.rdp b/roles/l3d.rdp new file mode 160000 index 0000000..90a2558 --- /dev/null +++ b/roles/l3d.rdp @@ -0,0 +1 @@ +Subproject commit 90a2558a71fd993b49ea566409ed76475298a6db diff --git a/roles/l3d.sshd b/roles/l3d.sshd new file mode 160000 index 0000000..ca2bd9c --- /dev/null +++ b/roles/l3d.sshd @@ -0,0 +1 @@ +Subproject commit ca2bd9cbc7026d8a25c67beb6805f1693b14c0e4 diff --git a/roles/l3d.time b/roles/l3d.time new file mode 160000 index 0000000..cf24cdb --- /dev/null +++ b/roles/l3d.time @@ -0,0 +1 @@ +Subproject commit cf24cdb5c2c8c142428ef9d945a65b4704b3d976 diff --git a/roles/l3d.win_exporter b/roles/l3d.win_exporter new file mode 160000 index 0000000..2d8c582 --- /dev/null +++ b/roles/l3d.win_exporter @@ -0,0 +1 @@ +Subproject commit 2d8c58259394e6f70880c07e6da3ceb217af6110 diff --git a/roles/powerplan/defaults/main.yml b/roles/powerplan/defaults/main.yml new file mode 100644 index 0000000..77c4c42 --- /dev/null +++ b/roles/powerplan/defaults/main.yml @@ -0,0 +1,2 @@ +--- +powerplan__mode: 'high performance' diff --git a/roles/powerplan/tasks/main.yml b/roles/powerplan/tasks/main.yml new file mode 100644 index 0000000..f7863b2 --- /dev/null +++ b/roles/powerplan/tasks/main.yml @@ -0,0 +1,20 @@ +--- +- name: Change the power plan to high performance + community.windows.win_power_plan: + name: "{{ powerplan__mode }}" + register: _pwr + +- name: "Apply custom powerplan poweshell script" + 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 + changed_when: _pwr.changed diff --git a/site.yml b/site.yml index 3983fc0..c0a543f 100644 --- a/site.yml +++ b/site.yml @@ -10,6 +10,13 @@ roles: - {role: l3d.choco, tags: choco} - {role: win_activating, tags: zeroconf} + - {role: hostname, tags: hostname} + - {role: l3d.icmp, tags: ping} - {role: win_zeroconf, tags: zeroconf} + - {role: powerplan, tags: powerplan} + - {role: l3d.sshd, tags: ssh} + - {role: l3d.time, tags: time} + - {role: l3d.rdp, tags: rdp} # - {role: win_gopass, tags: gopass} - {role: l3d.wireguard, tags: wireguard} + - {role: roles/l3d.win_exporter, tags: monitoring}