Initial commit
[ta/infra-ansible.git] / playbooks / single_node_partitions.yml
1 ---
2
3 # Copyright 2019 Nokia
4
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 - hosts: management
18   become: yes
19   become_method: sudo
20   become_user: root
21   gather_facts: no
22   tasks:
23     # To avoid this warning in lvs -command: WARNING: Not using lvmetad because config setting use_lvmetad=0.
24   - name: patch use_lvmetad parameter in lvm.conf
25     lineinfile: path=/etc/ansible/roles/os_cinder/templates/lvm.conf.j2  regexp='^\s*use_lvmetad ='   line='    use_lvmetad = 1'
26
27   - name: instance disks disk layout
28     debug:
29       msg: "Controller instance devices: {{ instance_disks }}"
30     when: instance_disks is defined
31
32   - name: make partition table for nova in controller
33     parted: device={{ item }}  number=1  label=gpt  state=present
34     with_items: "{{ instance_disks }}"
35     when: instance_disks is defined
36
37   - name: Inform the OS of partition table changes
38     shell: "/sbin/partprobe {{ item }}"
39     with_items: "{{ instance_disks }}"
40     when: instance_disks is defined
41
42   - name: set Linux LVM type to partition
43     shell: "[ -b {{ item }} ] | parted {{ item }} set 1 lvm on"
44     with_items: "{{ instance_disks }}"
45     when: instance_disks is defined
46
47   - name: cinder disk layout
48     debug:
49       msg: "Controller cinder devices: {{ devices }}"
50     when: devices is defined
51
52   - name: make partition table for cinder in controller
53     parted: device={{ item }}  number=1  label=gpt  state=present
54     with_items: "{{ devices }}"
55     when: devices is defined
56
57   - name: Inform the OS of partition table changes
58     shell: "/sbin/partprobe {{ item }}"
59     with_items: "{{ devices }}"
60     when: devices is defined
61
62   - name: set Linux LVM type to partition
63     shell: "[ -b {{ item }} ] | parted {{ item }} set 1 lvm on"
64     with_items: "{{ devices }}"
65     when: devices is defined