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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 - name: Gather variables for each operating system
18 include_vars: "{{ item }}"
20 - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
21 - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
22 - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
23 - "{{ ansible_distribution | lower }}.yml"
24 - "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
25 - "{{ ansible_os_family | lower }}.yml"
29 - name: Stop all cloud-init services and disable them
40 - name: Remove udev rule which enables dhcp on the first interface
41 file: path="/etc/udev/rules.d/70-persistent-net.rules" state=absent
43 - name: Remove interface configuration which use dhcp
44 shell: rm -f $(grep -li BOOTPROTO.*dhcp /etc/sysconfig/network-scripts/ifcfg-* | sort -u)
47 root_disk_part1: "{% if root_disk == default_rootdisk_device %}{{root_disk}}{{first_part_number}}{% else %}{{root_disk}}-part{{first_part_number}}{% endif %}"
49 - name: get volume pools
50 shell: dmsetup ls | awk '{print $1}'
51 register: volume_pools
55 msg: "volume pools: {{ volume_pools.stdout_lines }}"
57 - name: Delete old LVMs if not mounted already
58 script: "{{role_path}}/scripts/old_vol_rm.sh"
60 creates: /etc/partfs_rootdisk_created
62 - name: get volume groups
63 shell: "vgs -o vg_name --noheadings | sed 's/ //g'"
64 register: volumegroups
68 msg: "volume groups: {{ volumegroups.stdout_lines }}"
70 - name: get volume pools
71 shell: dmsetup ls | awk '{print $1}'
72 register: volume_pools
76 msg: "volume pools: {{ volume_pools.stdout_lines }}"
78 - name: remove old volume groups
79 include: remove_old_instance_vg.yml
81 - name: delete temporary partition
83 device: "{{root_disk}}"
84 number: "{{delete_partition}}"
86 when: delete_partition is defined
88 - name: system disk total size
89 shell: parted {{root_disk}} unit GB print | grep "Disk /dev/" | awk '{print $3}' | tr -d 'a-z,A-Z'
90 register: root_disk_total_size
93 msg: "root_disk_total_size.stdout {{ root_disk_total_size.stdout }}"
95 - name: configure root volume groups
96 include: root_disk_volume_groups.yml
98 part_start: "{{second_part_start}}GiB"
99 part_end: "{{second_part_end}}GB"
100 phy_disk_part_number: 2
101 create_disk_part: True
103 - name: system disk first partition size
104 shell: parted {{root_disk_part1}} unit GB print | grep "Disk /dev/" | awk '{print $3}' | tr -d 'a-z,A-Z'
108 msg: "first_part.stdout {{ first_part.stdout }}"
110 - name: configure instance disk partition
112 device: "{{root_disk}}"
114 part_start: "{{third_part_start}}GB"
117 when: rootdisk_vg_percentage != all_disk_size_for_volume_group_vg
119 - name: remove old volume groups
120 include: remove_old_instance_vg.yml
122 - name: create /etc/partfs_rootdisk_created file
123 command: touch /etc/partfs_rootdisk_created
125 creates: /etc/partfs_rootdisk_created