choco source addcommand to add the repository, using
--passwordarguments to specify the login; then Chocolatey Gui will pick up that source because it uses the same config that
choco.exeuses. The other option is to go into the Chocolatey GUI settings, go over to the sources tab, and set the username and password for the repository source that needs it.
choco install PACKAGES -s .. 2 out of the 3 work fine when invoked using the win_chocolatey module as well. But one is not working.
2021-01-24 23:05:05,944 6084 [INFO ] - Installing orthocad... 2021-01-24 23:05:05,990 6084 [DEBUG] - Running Start-ChocolateyProcessAsAdmin -validExitCodes '0' -workingDirectory 'C:\tmp\chocolatey\orthocad\1.0' -statements ' ' -exeToRun 'C:\tmp\chocolatey\orthocad\1.0\iTero_Online_Setup_18.104.22.168.exe' 2021-01-24 23:05:05,990 6084 [DEBUG] - Unable to use current location for Working Directory. Using Cache Location instead. 2021-01-24 23:05:06,005 6084 [DEBUG] - Test-ProcessAdminRights: returning True 2021-01-24 23:05:06,020 6084 [DEBUG] - Elevating permissions and running ["C:\tmp\chocolatey\orthocad\1.0\iTero_Online_Setup_22.214.171.124.exe" ]. This may take a while, depending on the statements.
Elevating permissions and running. So that at least rules out AHK. Not yet sure why it can't move any further. Other packages install and work just fine with Ansible/chocolatey...
vagrantand they are in the
So there must be some slight difference with out the win_chocolatey module executes the script.. or something with WinRM... maybe I can try it through OpenSSH instead.
WinRM could definitely be the problem, I have heard in the past that it had caused issues with certain packages (especially for autohotkey packages, and packages installing services).
Not sure what the exact problem was though, nor if there ever was a solution for it. Testing using ssl could be something worthwhile for you to test in this case, but not sure if that would really solve the issue. But there is a possibility
I've tried it with
- name: Install Orthodontic apps win_chocolatey: name: orthocad source: C:\coretechonomy\chocolatey\ become: yes become_user: vagrant become_flags: logon_type=interactive logon_flags=with_profile # https://docs.ansible.com/ansible/latest/user_guide/become.html
No luck yet though :(
@etho201 You won't be able to install a package using Ansible with Autohotkey. Autohotkey requires an interactive session which you won't get whether you run
become or not (
become really just allows you to either elevate your session or become another user). This isn't a failure of Chocolatey or Ansible. It's just the way that Ansible works. And Puppet. And PowerShell DSC. And Chef. Packages that require Autohotkey are just not going to work running headlessly (as @thecakeisnaoh said above).
Having said that, you might want to look at
win_psexec (Ansible docs). I haven't used it for this specific scenario, so it may still not work, and you will likely need to have a logged on user for it to work (as it interacts with a user session). You will also have to grab the user session ID to use that session (I can share the code I have for this if this is an option for you). What I will say is I have a playbook that builds my desktop from scratch and some software requires to be run interactively (not using it for Chocolatey installs or Autohotkey though) and this is the way I found to get it to work.