aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/nova/tasks/start_compute.yml
blob: d40e7a007cb27e2834bd6d3ead8167d7f3331ef1 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
- name: Starting nova-libvirt container
  kolla_docker:
    action: "start_container"
    common_options: "{{ docker_common_options }}"
    image: "{{ nova_libvirt_image_full }}"
    name: "nova_libvirt"
    pid_mode: "host"
    privileged: True
    volumes:
      - "{{ node_config_directory }}/nova-libvirt/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "/lib/modules:/lib/modules:ro"
      - "/run/:/run/:shared"
      - "/dev:/dev"
      - "/sys/fs/cgroup:/sys/fs/cgroup"
      - "kolla_logs:/var/log/kolla/"
      - "libvirtd:/var/lib/libvirt"
      - "nova_compute:/var/lib/nova/"
      - "/var/lib/nova/mnt:/var/lib/nova/mnt:shared"
      - "nova_libvirt_qemu:/etc/libvirt/qemu"
  register: start_nova_libvirt_container
  # NOTE(Jeffrey4l): retry 5 to remove nova_libvirt container because when
  # guests running, nova_libvirt will raise error even though it is removed.
  retries: 5
  until: start_nova_libvirt_container|success
  when: inventory_hostname in groups['compute']

- name: Prepare volumes list
  set_fact:
     mounts:
      - "{{ node_config_directory }}/nova-compute/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "/lib/modules:/lib/modules:ro"
      - "/run:/run:shared"
      - "/dev:/dev"
      - "kolla_logs:/var/log/kolla/"
      - "{% if enable_iscsid | bool %}iscsi_info:/etc/iscsi{% endif %}"
      - "libvirtd:/var/lib/libvirt"
      - "nova_compute:/var/lib/nova/"
      - "/var/lib/nova/mnt:/var/lib/nova/mnt:shared"

- name: Starting nova-compute container
  kolla_docker:
    action: "start_container"
    common_options: "{{ docker_common_options }}"
    image: "{{ nova_compute_image_full }}"
    name: "nova_compute"
    privileged: True
    volumes: '{{ mounts | reject("equalto", "") | list}}'
  when:
    - inventory_hostname in groups['compute']
    - not enable_nova_fake | bool
    - not enable_ironic | bool

- name: Starting nova-compute-ironic container
  kolla_docker:
    action: "start_container"
    common_options: "{{ docker_common_options }}"
    image: "{{ nova_compute_ironic_image_full }}"
    name: "nova_compute_ironic"
    volumes:
      - "{{ node_config_directory }}/nova-compute-ironic/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "kolla_logs:/var/log/kolla/"
  when:
    - inventory_hostname in groups['nova-compute-ironic']
    - enable_ironic | bool

- name: Starting nova-compute-fake containers
  kolla_docker:
    action: "start_container"
    common_options: "{{ docker_common_options }}"
    image: "{{ nova_compute_image_full }}"
    name: "nova_compute_fake_{{ item }}"
    privileged: True
    volumes:
      - "{{ node_config_directory }}/nova-compute-fake-{{ item }}/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "/lib/modules:/lib/modules:ro"
      - "/run:/run:shared"
      - "kolla_logs:/var/log/kolla/"
  with_sequence: start=1 end={{ num_nova_fake_per_node }}
  when:
    - inventory_hostname in groups['compute']
    - enable_nova_fake | bool

- name: Starting nova-ssh container
  kolla_docker:
    action: "start_container"
    common_options: "{{ docker_common_options }}"
    image: "{{ nova_ssh_image_full }}"
    name: "nova_ssh"
    volumes:
      - "{{ node_config_directory }}/nova-ssh/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "kolla_logs:/var/log/kolla"
      - "nova_compute:/var/lib/nova"
      - "/var/lib/nova/mnt:/var/lib/nova/mnt:shared"
      - "heka_socket:/var/lib/kolla/heka/"
  # TODO(jeffrey4l): how to handle the nova-compute-fake and
  # nova-compute-ironic
  when: inventory_hostname in groups['compute']