{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/19825","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/19825/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/19825/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/19825/events","html_url":"https://github.com/ansible/ansible/issues/19825","id":198542622,"number":19825,"title":"win_reboot never successfully continues after reboot is successful ","user":{"login":"Kbooth-rms","id":17933366,"avatar_url":"https://avatars0.githubusercontent.com/u/17933366?v=4","gravatar_id":"","url":"https://api.github.com/users/Kbooth-rms","html_url":"https://github.com/Kbooth-rms","followers_url":"https://api.github.com/users/Kbooth-rms/followers","following_url":"https://api.github.com/users/Kbooth-rms/following{/other_user}","gists_url":"https://api.github.com/users/Kbooth-rms/gists{/gist_id}","starred_url":"https://api.github.com/users/Kbooth-rms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kbooth-rms/subscriptions","organizations_url":"https://api.github.com/users/Kbooth-rms/orgs","repos_url":"https://api.github.com/users/Kbooth-rms/repos","events_url":"https://api.github.com/users/Kbooth-rms/events{/privacy}","received_events_url":"https://api.github.com/users/Kbooth-rms/received_events","type":"User","site_admin":false},"labels":[{"id":437720699,"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.2","name":"affects_2.2","color":"5319e7","default":false},{"id":48276055,"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04","default":false},{"id":496359346,"url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":54811101,"url":"https://api.github.com/repos/ansible/ansible/labels/needs_info","name":"needs_info","color":"eb6420","default":false},{"id":636352796,"url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false},{"id":108461331,"url":"https://api.github.com/repos/ansible/ansible/labels/windows","name":"windows","color":"777777","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2017-01-03T18:54:23Z","updated_at":"2017-09-26T16:11:31Z","closed_at":null,"author_association":"NONE","body":"\r\n\r\n##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\nwin_reboot module\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.2.0.0\r\n```\r\n\r\n##### CONFIGURATION\r\nno special configs needed except username/password for winrm\r\n\r\n##### OS / ENVIRONMENT\r\nWindows Server 2012R2 Datacenter\r\n\r\n##### SUMMARY\r\nwin_reboot never successfully continue after machine is rebooted, thus blocking playbook execution.\r\n\r\nThe machine in question has in fact been rebooted and is available for connections.\r\n\r\n##### STEPS TO REPRODUCE\r\n\r\n```\r\n- name: Reboot for changes to take effect\r\n  win_reboot: reboot_timeout_sec=3600\r\n              connect_timeout_sec=3600\r\n              shutdown_timeout_sec=3600\r\n\r\n```\r\n\r\n\r\nWith verbosity cranked up  this is the output:\r\n\r\n```\r\nTASK [risklink-common : Reboot for changes to take effect] *********************\r\ntask path: /Users/kbooth/rms/rms-ansible/roles/risklink-common/tasks/main.yml:71\r\n<10.92.4.10> ESTABLISH WINRM CONNECTION FOR USER: ***** on PORT 5986 TO 10.92.4.10\r\n<10.92.4.10> EXEC shutdown /r /t 2\r\n\r\n```\r\n\r\n\r\n##### EXPECTED RESULTS\r\nExpect that ansible will detect machine is back online after reboot and continue executing plays\r\n\r\n##### ACTUAL RESULTS\r\n\r\nActual results are that ansible waits forever until timeout values are reached.\r\n\r\n\r\n```\r\nTASK [risklink-common : Reboot for changes to take effect] *********************\r\ntask path: /Users/kbooth/rms/rms-ansible/roles/risklink-common/tasks/main.yml:71\r\n<10.92.4.10> ESTABLISH WINRM CONNECTION FOR USER: techops on PORT 5986 TO 10.92.4.10\r\n<10.92.4.10> EXEC shutdown /r /t 2\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/332250630","html_url":"https://github.com/ansible/ansible/issues/19825#issuecomment-332250630","issue_url":"https://api.github.com/repos/ansible/ansible/issues/19825","id":332250630,"user":{"login":"richard-scott","id":5149834,"avatar_url":"https://avatars1.githubusercontent.com/u/5149834?v=4","gravatar_id":"","url":"https://api.github.com/users/richard-scott","html_url":"https://github.com/richard-scott","followers_url":"https://api.github.com/users/richard-scott/followers","following_url":"https://api.github.com/users/richard-scott/following{/other_user}","gists_url":"https://api.github.com/users/richard-scott/gists{/gist_id}","starred_url":"https://api.github.com/users/richard-scott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richard-scott/subscriptions","organizations_url":"https://api.github.com/users/richard-scott/orgs","repos_url":"https://api.github.com/users/richard-scott/repos","events_url":"https://api.github.com/users/richard-scott/events{/privacy}","received_events_url":"https://api.github.com/users/richard-scott/received_events","type":"User","site_admin":false},"created_at":"2017-09-26T16:11:31Z","updated_at":"2017-09-26T16:11:31Z","author_association":"NONE","body":"The only fix I have is to use the [vagrant-reload](https://github.com/aidanns/vagrant-reload), [vagrant-triggers](https://github.com/emyl/vagrant-triggers), and [vagrant-host-shell](https://github.com/phinze/vagrant-host-shell) plugins.\r\n\r\n```\r\n$ vagrant plugin install vagrant-reload\r\n$ vagrant plugin install vagrant-host-shell\r\n$ vagrant plugin install vagrant-triggers\r\n```\r\n\r\nI then add the following to my Vagrantfile when I need a reboot:\r\n\r\n```\r\nconfig.vm.provision :reload\r\n```\r\n\r\nI ended up splitting up my playbooks by tagging tasks. You can tag a task with \"tag: always\" to get it to run every time. I then manually call Ansible during \"for\" loop itterating through a list of \"tags\". \r\n\r\nHere is my Vagrantfile:\r\n\r\n```                                                                                                                                                                                           \r\nVagrant.configure(\"2\") do |config|         \r\n                                                                                                                                                 \r\n  config.vm.box_check_update = false                                                                                                                                                        \r\n  config.vbguest.auto_update = false                                                                                                                                                         \r\n  config.vm.box = \"opentable/win-2012r2-standard-amd64-nocm\"   \r\n                                                                                                                             \r\n  config.vm.provider :virtualbox do |vb|                                                                                                                                                    \r\n    vb.name = \"custom-VAGRANTSLASH-opentable-win-2012r2-standard-amd64-nocm\"                                                                                                                 \r\n    vb.customize [\"modifyvm\", :id, \"--vram\", \"64\"]                                                                                                                                          \r\n    vb.customize [\"modifyvm\", :id, \"--cpus\", \"2\"]                                                                                                                                           \r\n    vb.customize [\"modifyvm\", :id, \"--memory\", \"2048\"]                                                                                                                                      \r\n    vb.customize [\"storageattach\", :id, \"--storagectl\", \"IDE Controller\", \"--port\", \"1\", \"--device\", \"0\", \"--type\", \"dvddrive\", \"--medium\", \"/usr/share/virtualbox/VBoxGuestAdditions.iso\"] \r\n  end                                                                                                                                                                                       \r\n\r\n  config.vm.boot_timeout=3600                                                                                                                                                               \r\n  config.vm.synced_folder \".\",\"/vagrant\", disabled: true                                                                                                                                    \r\n\r\n  config.vm.provision :host_shell do |host_shell|                                                                                                                                           \r\n    host_shell.inline = 'mkdir -p provisioning/ansible'                                                                                                                                     \r\n  end                                                                                                                                                                                       \r\n\r\n  config.vm.provision :host_shell do |host_shell|                                                                                                                                           \r\n    host_shell.inline = 'echo -e \"---\\n- hosts: all\\n  gather_facts: no\\n\" > provisioning/ansible/blank.yml'                                                                                \r\n  end                                                                                                                                                                                       \r\n\r\n  config.vm.provision \"ansible\" do |ansible|                                                                                                                                                \r\n    ansible.playbook = \"provisioning/ansible/blank.yml\"                                                                                                                                     \r\n  end                                                                                                                                                                                       \r\n\r\n  for tag in [ 'vbox', 'timezone', 'region', 'updates' ]                                                                                                                                   \r\n    config.vm.provision :host_shell do |host_shell|                                                                                                                                         \r\n      host_shell.abort_on_nonzero = true                                                                                                                                                    \r\n      ENV['ANSIBLE_INVENTORY'] = File.join(Dir.pwd,'.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory')                                                                     \r\n      host_shell.inline = \"ansible-playbook -e ansible_winrm_scheme=http --tags #{tag} win2k.yml\"                                                                                            \r\n    end                                                                                                                                                                                     \r\n    config.vm.provision :reload                                                                                                                                                             \r\n  end                                                                                                                                                                                       \r\n\r\n  config.trigger.after [ :destroy ] do                                                                                                                                                      \r\n    run \"rm -rf provisioning\"                                                                                                                                                               \r\n  end                                                                                                                                                                                       \r\n\r\nend                                                                                                                                                                                         \r\n```\r\n\r\nI've not yet found a way to do a conditional reboot e.g. skip a reboot if its not actually required. But as this all only happens on provisioning the server I'm not that concerned for now."}}
{"actor":{"display_login":"richard-scott"}}