Merge branch 'logon' into 'main'

Logon script completion

See merge request win_automation/windows-ansible!4
This commit is contained in:
abrown38 committed 2025-01-27 10:07:40 +00:00
commit 5eabf5678f
11 files changed
+27 -40

No files matched your search

+2 -1
View File
@@ -7,6 +7,7 @@ ask_pass=False
forks=30
host_key_checking=False
force_valid_group_names=ignore
# Stuff for Dynamic Inventories
fast_caching = ansible.builtin.jsonfile
@@ -18,4 +19,4 @@ cache = yes
cache_connection = /tmp/ansible_inventory
[inventory_plugins]
use_extra_vars = true
use_extra_vars = true
+7 -7
View File
@@ -17,7 +17,7 @@
name: "{{ os_project }}-{{ win_project }}-wb{{ '%02d' | format(item+1) }}"
state: "{{ state }}"
image: "{{ vm_image }}"
flavor: 3661211f-673a-4777-8857-fd243d6c407d
flavor: "{{ user_vm_flavor }}"
timeout: 900
boot_from_volume: true
volume_size: 40
@@ -52,7 +52,7 @@
name: "{{ os_project }}-{{ win_project }}-wb{{ '%02d' | format(item+1) }}"
state: "{{ state }}"
image: "{{ vm_image }}"
flavor: 3661211f-673a-4777-8857-fd243d6c407d
flavor: "{{ user_vm_flavor }}"
timeout: 900
boot_from_volume: true
volume_size: 40
@@ -93,7 +93,7 @@
name: "{{ os_project }}-{{ win_project }}-app{{ '%02d' | format(item+1) }}"
state: "{{ state }}"
image: "{{ vm_image }}"
flavor: 3661211f-673a-4777-8857-fd243d6c407d
flavor: "{{ user_vm_flavor }}"
timeout: 900
boot_from_volume: true
volume_size: 40
@@ -128,7 +128,7 @@
name: "{{ os_project }}-{{ win_project }}-app{{ '%02d' | format(item+1) }}"
state: "{{ state }}"
image: "{{ vm_image }}"
flavor: 3661211f-673a-4777-8857-fd243d6c407d
flavor: "{{ user_vm_flavor }}"
timeout: 900
boot_from_volume: true
volume_size: 40
@@ -169,7 +169,7 @@
name: "{{ os_project }}-{{ win_project }}-gpu{{ '%02d' | format(item+1) }}"
state: "{{ state }}"
image: "{{ vm_image }}"
flavor: 3661211f-673a-4777-8857-fd243d6c407d
flavor: "{{ gpu_flavor }}"
timeout: 900
boot_from_volume: true
volume_size: 40
@@ -204,7 +204,7 @@
name: "{{ os_project }}-{{ win_project }}-gpu{{ '%02d' | format(item+1) }}"
state: "{{ state }}"
image: "{{ vm_image }}"
flavor: 3661211f-673a-4777-8857-fd243d6c407d
flavor: "{{ gpu_flavor }}"
timeout: 900
boot_from_volume: true
volume_size: 40
@@ -247,7 +247,7 @@
name: "{{ item.name }}"
state: "{{ state }}"
image: "{{ vm_image }}"
flavor: 3661211f-673a-4777-8857-fd243d6c407d
flavor: "{{ server_vm_flavor }}"
timeout: 3600
boot_from_volume: true
volume_size: 40
-28
View File
@@ -1,28 +0,0 @@
$bashProfilePath = Join-Path $HOME ".bash_profile"
$condaPath = "C:\tools\miniforge3\Scripts\conda.exe"
$requiredLine = 'eval "$(''/C/tools/miniforge3/Scripts/conda.exe'' ''shell.bash'' ''hook'')"'
if (Test-Path $condaPath) {
Write-Host "Miniforge3 is installed at $condaPath"
if (Test-Path $bashProfilePath) {
$currentContent = Get-Content -Path $bashProfilePath -ErrorAction SilentlyContinue
if ($currentContent -contains $requiredLine) {
Write-Host "The required line is already present in .bash_profile"
} else {
Add-Content -Path $bashProfilePath -Value $requiredLine
Write-Host "The required line has been added to .bash_profile"
}
} else {
Set-Content -Path $bashProfilePath -Value $requiredLine -Force
Write-Host ".bash_profile created with the required line"
}
Set-ItemProperty -Path $bashProfilePath -Name Attributes -Value ([System.IO.FileAttributes]::Hidden)
Write-Host ".bash_profile is set to hidden"
} else {
Write-Host "Miniforge3 is not installed. Exiting."
}
-1
View File
@@ -3,4 +3,3 @@
- import_tasks: chocolatey.yml
- import_tasks: rdgw.yml
- import_tasks: start_menu.yml
- import_tasks: logon.yml
+3 -1
View File
@@ -60,4 +60,6 @@
DomainName: "{{ win_project }}.loc"
PsDscRunAsCredential_username: Administrator
PsDscRunAsCredential_password: "{{ ansible_password }}"
when: inventory_hostname in groups['meta-name_fs01']
when: | # maybe change second condition or use resuce
inventory_hostname in groups['meta-name_fs01'] and
feature_status.reboot_required == true
@@ -411,6 +411,12 @@ New-GPLink -Name "Firefox" -Target $workbenchou
New-GPLink -Name "Chrome" -Target $workbenchou
#New-GPLink -Name "firewall" -Target $workbenchou
#Logon Script Reg Keys
New-GPO -Name "User Logon Script"
Set-GPRegistryValue -Name "User Logon Script" -Key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce" -ValueName "ExecutionPolicy" -Type String -Value "powershell C:\eidf\logon.ps1"
New-GPLink -Name "User Logon Script" -Target $workbenchou
#add entry for WSUS
@@ -0,0 +1,5 @@
$bashProfilePath = Join-Path $HOME ".bash_profile"
$requiredLine = 'eval "$(''/C/tools/miniforge3/Scripts/conda.exe'' ''shell.bash'' ''hook'')"'
Add-Content -Path $bashProfilePath -Value $requiredLine
Set-ItemProperty -Path $bashProfilePath -Name Attributes -Value ([System.IO.FileAttributes]::Hidden)
@@ -1,7 +1,7 @@
---
- name: Copy logon script to VMs
tags:
- copy_logon_script
- logon
block:
- name: Copy logon script to VMs
win_copy:
@@ -1,3 +1,4 @@
---
- import_tasks: features.yml
- import_tasks: setup.yml
- import_tasks: logon.yml
+1
View File
@@ -13,6 +13,7 @@ vm_image: 3f193ea7-321d-418b-a233-da64661b08b1
proxy_image: 62669efd-ee43-4148-848c-b82f49ca2f45
server_vm_flavor: 3661211f-673a-4777-8857-fd243d6c407d
user_vm_flavor: 3661211f-673a-4777-8857-fd243d6c407d
#user_vm_flavor: a82596d8-175b-45d2-b7db-d1658b3dd643
gpu_flavor: b07fc115-e48e-4289-b220-baae18c8db8a
filetransfer_user: file-transfer
+1 -1
View File
@@ -65,7 +65,7 @@ post_request() {
-H "content-type: application/json" \
-H "accept: application/json" \
-H "Authorization: Token $API_TOKEN" \
-d "'$(jq -c . $VM_JSON)'" \
-d "$(jq -c . $VM_JSON)" \
$API_ENDPOINT
}