blob: 7797b54683fbae766344f2ddef07d806ac422643 [file] [log] [blame]
Matteo Scandolo60b640f2017-08-08 13:05:22 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Andy Bavier2505f592016-11-11 15:58:55 -050017- name: Check if the disk is partitioned
18 stat: path={{ extra_disk_dev }}1
19 register: device_stat
20
21- name: Set disk label
22 command: parted {{ extra_disk_dev }} mklabel msdos
23 when: device_stat.stat.exists == false
24
25- name: Create primary partition
26 command: parted {{ extra_disk_dev }} mkpart primary 1 100%
27 when: device_stat.stat.exists == false
28
29- name: Make filesystem
30 filesystem:
31 fstype: ext4
32 dev: "{{ extra_disk_dev }}1"
33
34- name: Mount extra disk
35 mount:
36 name: /mnt
37 src: "{{ extra_disk_dev }}1"
38 fstype: ext4
39 state: mounted
40
41- name: Create directories
42 file:
43 path: "{{ item.src }}"
44 state: directory
45 with_items: "{{ extra_disk_links }}"
46
47- name: Set up links
48 file:
49 src: "{{ item.src }}"
50 dest: "{{ item.dest }}"
51 state: link
52 with_items: "{{ extra_disk_links }}"