I am using Ansible to install Visual Studio Build Tools 2022. I am trying to install specific workloads and using the documentation from Microsoft , ansible and choco but still not able to install the workloads I want with Ansible. I am new with Ansible so not sure what I am doing wrong.
My playbook run seems to complete with no issue, when I go to the server it is installing the visual studio installer is there but the workloads I need are not installed.
- name: Install VS Tools
win_chocolatey:
name: visualstudio2022buildtools
state: latest
version: 117.9.0.0
install_args:
"--passive --wait ----includeOptional --add Microsoft.VisualStudio.Workload.NodeBuildTools --add Microsoft.VisualStudio.Workload.WebBuildTools --add Microsoft.VisualStudio.Workload.DataBuildTools --add Microsoft.VisualStudio.Workload.MSBuildTools"
register: vs_output
output:
TASK [register for vs tools] ****************************************************************************
ok: [win_test] => {
"msg": " {'changed': False, 'rc': 0, 'choco_cli_version': '2.2.2',
'failed': False}"
}
NOTE: I haven't directly tried the following, but I am basing this on how I believe the Visual Studio packages work.
The combination of Visual Studio Chocolatey packages rely on the usage of Package Parameters, or rather the
package_paramsargument, rather than the Installation Arguemnts, or ratherinstall_args, argument in your Ansible script.https://docs.ansible.com/ansible/latest/collections/chocolatey/chocolatey/win_chocolatey_module.html#parameter-package_params
This can be seen in the example from taken from here:
As such, I think the correct way of doing this would be:
Also, based on this (taken from here):
You may want to re-think your usage of the
--waitand--passivearguments that you were attempting to pass in.