summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-kernel.yml
blob: 6d4ca0355526df8df9a63142c505a2d55ba613b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
#- hosts: all 
#  sudo: yes
#  tasks:
- name: "install Ubuntu kernel"
#  sudo: True
#      apt:
#        name: "linux-headers-3.13.0-40"
#        name: "linux-headers-3.13.0-40-generic"
#        name: "linux-image-3.13.0-40-generic"
#        name: "linux-image-extra-3.13.0-40-generic"
#      when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic")
  action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
  with_items: kernel_packages | union(kernel_packages_noarch)
  when: (kernel_install) and (ansible_kernel != kernel_required)

- name: "setup grub"
#  sudo: True
  lineinfile: 
    dest: "/etc/default/grub"
    regexp: "GRUB_DEFAULT=.*"
    line: "GRUB_DEFAULT='Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-40-generic'"
#      when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic")
  when: (kernel_install) and (ansible_kernel != kernel_required)

- name: "reflect grub"
#  sudo: True
  shell: "update-grub2"
#      when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic")
  when: (kernel_install) and (ansible_kernel != kernel_required)

- name: "reboot Server"
#  sudo: True
  shell: "shutdown -r now"
  async: 0
  poll: 0
  ignore_errors: true
  notify: Wait for server to come back
#      when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic")
  when: (kernel_install) and (ansible_kernel != kernel_required)

handlers:
- name: "Wait for server to come back"
  local_action:
    module: wait_for
      host={{ inventory_hostname }}
      port=22
      delay=30
      timeout=600
#      when: (kernel_install) and (ansible_kernel != "3.13.0-40-generic")
  when: (kernel_install) and (ansible_kernel != kernel_required)