---- hosts: win10-pro-1 gather_facts: yes tasks: - name: Re-Boot PC before upgrade win_reboot:
- name: Upgrade Windows 10 win_updates: category_names: - Upgrades state: installed register: update_result
- name: reboot host if required win_reboot: when: update_result.reboot_required[vagrant@controller win_10_Updates]$ ansible-playbook testFeatureUPdate.yml
PLAY [win10-pro-1] ***********************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************
ok: [win10-pro-1]
TASK [Re-Boot PC before upgrade] *********************************************************************************************************
changed: [win10-pro-1]
TASK [Upgrade Windows 10] ****************************************************************************************************************
changed: [win10-pro-1]
TASK [reboot host if required] ***********************************************************************************************************
changed: [win10-pro-1]
PLAY RECAP *******************************************************************************************************************************
win10-pro-1 : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[vagrant@controller win_10_Updates]$ [vagrant@controller win_10_Updates]$ ansible-playbook testFeatureUPdate.yml -vvv
ansible-playbook 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
PLAYBOOK: testFeatureUPdate.yml **********************************************************************************************
1 plays in testFeatureUPdate.yml
PLAY [win10-pro-1] ***********************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************
task path: /home/vagrant/ansible/win_10_Updates/testFeatureUPdate.yml:2
Using module file /usr/lib/python3.6/site-packages/ansible/modules/windows/setup.ps1
Pipelining is enabled.
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
ok: [win10-pro-1]
META: ran handlers
TASK [Re-Boot PC before upgrade] *********************************************************************************************
task path: /home/vagrant/ansible/win_10_Updates/testFeatureUPdate.yml:5
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
win_reboot: rebooting server...
EXEC (via pipeline wrapper)
win_reboot: validating reboot
win_reboot: attempting to get system boot time
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
win_reboot: attempting to get system boot time
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
win_reboot: attempting to get system boot time
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
win_reboot: attempting to get system boot time
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
win_reboot: attempting post-reboot test command
EXEC (via pipeline wrapper)
win_reboot: system successfully rebooted
changed: [win10-pro-1] => {
"changed": true,
"elapsed": 23,
"rebooted": true
}
TASK [Upgrade Windows 10] ****************************************************************************************************
task path: /home/vagrant/ansible/win_10_Updates/testFeatureUPdate.yml:8
win_updates: running win_updates module
Using module file /usr/lib/python3.6/site-packages/ansible/modules/windows/win_updates.ps1
Pipelining is enabled.
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
ok: [win10-pro-1] => {
"changed": false,
"failed_update_count": 0,
"filtered_updates": {},
"found_update_count": 1,
"installed_update_count": 1,
"reboot_required": true,
"updates": {
"ac2b20ab-6186-4267-8d55-4b3ca35197d1": {
"categories": [
"Upgrades"
],
"id": "ac2b20ab-6186-4267-8d55-4b3ca35197d1",
"installed": true,
"kb": [
"4560960"
],
"title": "Feature update to Windows 10, version 1909"
}
}
}
TASK [reboot host if required] ***********************************************************************************************
task path: /home/vagrant/ansible/win_10_Updates/testFeatureUPdate.yml:15
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
win_reboot: rebooting server...
EXEC (via pipeline wrapper)
win_reboot: validating reboot
win_reboot: attempting to get system boot time
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
win_reboot: attempting to get system boot time
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
win_reboot: attempting to get system boot time
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
win_reboot: attempting to get system boot time
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
EXEC (via pipeline wrapper)
<win10-pro-1> ESTABLISH WINRM CONNECTION FOR USER: vagrant on PORT 5986 TO win10-pro-1
win_reboot: attempting post-reboot test command
EXEC (via pipeline wrapper)
win_reboot: system successfully rebooted
changed: [win10-pro-1] => {
"changed": true,
"elapsed": 25,
"rebooted": true
}
META: ran handlers
META: ran handlers
PLAY RECAP *******************************************************************************************************************
win10-pro-1 : ok=4 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0


---- hosts: win10-pro-1 gather_facts: no tasks: - name: Re-Boot windows PC win_reboot:
EXEC (via pipeline wrapper)<span style="color:
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d248e549-cfae-45e8-8e66-91a6982a2afbo%40googlegroups.com.
Hi Corleone, the account that I am using is in the Administrators group on the windows 10 boxes. Right now, I am using a Dev environment using Vagrant. I have 4 windows 10 boxes that are all from Vagrant Cloud and a centos box for the ansible controller that is also from Vagrant Cloud. So, by default the Vagrant user is always an admin on the boxes.
I did also try to install Google Chrome with Ansible on these boxes with this playbook and it does work just to test it. Google Chrome does get installed:
---
- name: Install Google Chrome
hosts: win10-pro-1
gather_facts: no
tasks:
- win_chocolatey:
name:
- googlechrome
state: present
This is what I have in my hosts file for Ansible. Right now, I am just using the winPro group at the moment but Ansible can talk to all these machines with the win_ping:
[all]
win-10-1
win-10-2
win10-pro-1
win10-pro-2
server-1
server-2
[all:vars]
ansible_user=vagrant
ansible_password=vagrant
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore
[win]
win-10-1
win-10-2
[win:vars]
ansible_user=vagrant
ansible_password=vagrant
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore
[winPro]
win10-pro-1
win10-pro-2
[winPro:vars]
ansible_user=vagrant
ansible_password=vagrant
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore
[server]
server-1
server-2
[server:vars]
ansible_user=vagrant
ansible_password=vagrant
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore
The only thing I have in my ansible.cfg file is:
[defaults]
host_key_checking = false
timeout = 30
the hosts file and the ansble.cfg file are both in the default location of /etc/ansible.Thanks for any help on this I really appreciate it.
Hi Alan,Can you please check if the ansible account you are using for winrm has all root permissions i.e AdministratorThis is weird. I have achieved the same result back 6 months and it went smooth for me.Regards,Manash
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/53dda0f0-7b83-44c6-b253-2562b7758e10o%40googlegroups.com.