-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from charness/feature/upgrade_lts_kernel
Generalize LTS kernel upgrades to 14.04 and to vagrant
- Loading branch information
Showing
2 changed files
with
47 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
# reboot an Ubuntu machine if needed and wait for it to come back | ||
- name: Detect vagrant instance | ||
set_fact: | ||
is_vagrant: "{{is_vagrant | default(ansible_ssh_user == 'vagrant')}}" | ||
|
||
- name: Reboot instance | ||
command: /sbin/shutdown -r now | ||
args: | ||
removes: /var/run/reboot-required | ||
register: reboot_result | ||
|
||
- name: Reload vagrant instance | ||
local_action: command vagrant reload "{{inventory_hostname}}" | ||
when: reboot_result|changed and is_vagrant | ||
become: false | ||
|
||
- name: Wait for instance to come online | ||
local_action: | ||
module: wait_for | ||
host: "{{ ansible_ssh_host|default(inventory_hostname) }}" | ||
port: "{{ ansible_ssh_port|default(ssh_port) }}" | ||
delay: 30 | ||
timeout: 600 | ||
state: started | ||
when: reboot_result|changed | ||
become: false |