openstack-ansible/rpc_deployment/roles/nova_compute_devices/tasks/main.yml
Andy McCrae 6442c00a7a Allow the default (kvm) for nova_virt_type to be used
* Changes the 2 kvm tasks to use "virt_type" instead of "nova_virt_type"
* This var is specified from group_vars file and is defaulted.

Closes-Bug: #242
2014-10-03 14:42:13 +01:00

68 lines
1.9 KiB
YAML

---
# Copyright 2014, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Ensure container is running
lxc: >
name={{ container_name }}
command=start
delegate_to: "{{ physical_host }}"
when: is_metal != true
- name: Add nbd devices to the compute
shell: >
for i in /dev/nbd*; do lxc-device -n {{ container_name }} add $i $i; done;
delegate_to: "{{ physical_host }}"
when: is_metal != true
- name: Add net/tun device to the compute
shell: >
lxc-device -n {{ container_name }} add /dev/net/tun /dev/net/tun
delegate_to: "{{ physical_host }}"
when: is_metal != true
- name: Add kvm device to the compute
shell: >
lxc-device -n {{ container_name }} add /dev/kvm /dev/kvm
delegate_to: "{{ physical_host }}"
when: virt_type == 'kvm' and is_metal != true
- name: Ensure kvm permissions
shell: >
udevadm trigger
when: virt_type == 'kvm'
- name: Create log directory
file:
path: "/openstack/log/{{ physical_host}}"
state: directory
owner: nova
group: nova
mode: 0755
force: true
when: is_metal == true
- name: Remove old log dir on metal
shell: >
ls /openstack/log/{{ physical_host }}/nova-compute.log 2>/dev/null || rm -rf /var/log/nova/
when: is_metal == true
- name: Create log aggregation links
file:
src: "/openstack/log/{{ physical_host}}"
dest: "/var/log/nova"
state: "link"
when: is_metal == true