diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index 7c99a3d..4b7aa6c 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -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 \ No newline at end of file +use_extra_vars = true diff --git a/ansible/playbooks/openstack-vms.yml b/ansible/playbooks/openstack-vms.yml index 16e3685..feef99a 100644 --- a/ansible/playbooks/openstack-vms.yml +++ b/ansible/playbooks/openstack-vms.yml @@ -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 diff --git a/ansible/roles/win_client/files/logon.ps1 b/ansible/roles/win_client/files/logon.ps1 deleted file mode 100644 index f552d70..0000000 --- a/ansible/roles/win_client/files/logon.ps1 +++ /dev/null @@ -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." -} diff --git a/ansible/roles/win_client/tasks/main.yml b/ansible/roles/win_client/tasks/main.yml index 9acaa5e..2ba3891 100644 --- a/ansible/roles/win_client/tasks/main.yml +++ b/ansible/roles/win_client/tasks/main.yml @@ -3,4 +3,3 @@ - import_tasks: chocolatey.yml - import_tasks: rdgw.yml - import_tasks: start_menu.yml -- import_tasks: logon.yml diff --git a/ansible/roles/win_dfs/tasks/configure.yml b/ansible/roles/win_dfs/tasks/configure.yml index f71b919..61bca92 100644 --- a/ansible/roles/win_dfs/tasks/configure.yml +++ b/ansible/roles/win_dfs/tasks/configure.yml @@ -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 diff --git a/ansible/roles/win_domain_controller/files/OpenStackADBuildv7.5.3.ps1 b/ansible/roles/win_domain_controller/files/OpenStackADBuildv7.5.3.ps1 index ab6aae3..06886fd 100644 --- a/ansible/roles/win_domain_controller/files/OpenStackADBuildv7.5.3.ps1 +++ b/ansible/roles/win_domain_controller/files/OpenStackADBuildv7.5.3.ps1 @@ -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 diff --git a/ansible/roles/win_domain_controller/files/logon.ps1 b/ansible/roles/win_domain_controller/files/logon.ps1 new file mode 100644 index 0000000..fadf979 --- /dev/null +++ b/ansible/roles/win_domain_controller/files/logon.ps1 @@ -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) diff --git a/ansible/roles/win_client/tasks/logon.yml b/ansible/roles/win_domain_controller/tasks/logon.yml similarity index 88% rename from ansible/roles/win_client/tasks/logon.yml rename to ansible/roles/win_domain_controller/tasks/logon.yml index fd61f8b..83e63cd 100644 --- a/ansible/roles/win_client/tasks/logon.yml +++ b/ansible/roles/win_domain_controller/tasks/logon.yml @@ -1,7 +1,7 @@ --- - name: Copy logon script to VMs tags: - - copy_logon_script + - logon block: - name: Copy logon script to VMs win_copy: diff --git a/ansible/roles/win_domain_controller/tasks/main.yml b/ansible/roles/win_domain_controller/tasks/main.yml index 7663b70..3666add 100644 --- a/ansible/roles/win_domain_controller/tasks/main.yml +++ b/ansible/roles/win_domain_controller/tasks/main.yml @@ -1,3 +1,4 @@ --- - import_tasks: features.yml - import_tasks: setup.yml +- import_tasks: logon.yml diff --git a/ansible/vars/common.yml b/ansible/vars/common.yml index 7be21e6..6760b6e 100644 --- a/ansible/vars/common.yml +++ b/ansible/vars/common.yml @@ -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 diff --git a/register_vms.sh b/register_vms.sh index 1b5f4a5..688189d 100644 --- a/register_vms.sh +++ b/register_vms.sh @@ -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 }