blob: 7797b54683fbae766344f2ddef07d806ac422643 [file] [log] [blame]
# Copyright 2017-present Open Networking Foundation
#
# 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: Check if the disk is partitioned
stat: path={{ extra_disk_dev }}1
register: device_stat
- name: Set disk label
command: parted {{ extra_disk_dev }} mklabel msdos
when: device_stat.stat.exists == false
- name: Create primary partition
command: parted {{ extra_disk_dev }} mkpart primary 1 100%
when: device_stat.stat.exists == false
- name: Make filesystem
filesystem:
fstype: ext4
dev: "{{ extra_disk_dev }}1"
- name: Mount extra disk
mount:
name: /mnt
src: "{{ extra_disk_dev }}1"
fstype: ext4
state: mounted
- name: Create directories
file:
path: "{{ item.src }}"
state: directory
with_items: "{{ extra_disk_links }}"
- name: Set up links
file:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
state: link
with_items: "{{ extra_disk_links }}"