2 # Copyright 2015, Rackspace US, Inc.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 - name: Check for a supported Operating System
19 - (ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial') or
20 (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7')
21 msg: "The only supported platforms for this release are Ubuntu 16.04 LTS (Xenial) and CentOS 7 (WIP)"
23 - check-operating-system
25 - name: Identify the space available in /
27 df -BK / | awk '/^[^Filesystem]/ {print $4}' | sed 's/K//'
28 when: bootstrap_host_data_disk_device == None
30 register: root_space_available
34 # Convert root_space_available to bytes.
35 - name: Set root disk facts
37 host_root_space_available_bytes: "{{ ( root_space_available.stdout | int) * 1024 | int }}"
39 - bootstrap_host_data_disk_device == None
43 - name: Set data disk facts
45 host_data_disk_sectors: "{{ (ansible_devices[bootstrap_host_data_disk_device]['sectors'] | int) }}"
46 host_data_disk_sectorsize: "{{ (ansible_devices[bootstrap_host_data_disk_device]['sectorsize'] | int) }}"
48 - bootstrap_host_data_disk_device != None
52 # Calculate the size of the bootstrap_host_data_disk_device by muliplying sectors with sectorsize.
53 - name: Calculate data disk size
55 host_data_disk_size_bytes: "{{ ((host_data_disk_sectors | int) * (host_data_disk_sectorsize | int)) | int }}"
56 when: bootstrap_host_data_disk_device != None
60 # Convert bootstrap_host_data_disk_min_size to bytes.
61 - name: Set min size fact
63 host_data_disk_min_size_bytes: "{{ ((bootstrap_host_data_disk_min_size | int) * 1024**3) | int }}"
67 - name: Fail if there is not enough space available in /
70 (host_root_space_available_bytes | int) >= (host_data_disk_min_size_bytes | int)
71 when: bootstrap_host_data_disk_device == None
75 - name: Fail if there is not enough disk space available (disk specified)
78 (host_data_disk_size_bytes | int) >= (host_data_disk_min_size_bytes | int)
79 when: bootstrap_host_data_disk_device != None
83 - name: Ensure that the kernel has VXLAN support