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)
46 - name : Get system disk info
48 device: "{{root_disk}}"
50 register: root_disk_info
53 msg: "root_disk_info: {{root_disk_info}}"
56 sys_part: "{{ root_disk_info.partitions|selectattr('num', 'equalto', 1)|first }}"
58 when: root_disk_info.disk.table == "msdos"
61 sys_part: "{{ root_disk_info.partitions|selectattr('num', 'equalto', 3)|first }}"
63 when: root_disk_info.disk.table == "gpt"
66 msg: "sys_part = {{root_disk}}{{sys_part_number}}: {{sys_part}}"
68 - name: get volume pools
69 shell: dmsetup ls | awk '{print $1}'
70 register: volume_pools
74 msg: "volume pools: {{ volume_pools.stdout_lines }}"
76 - name: Delete old LVMs if not mounted already
77 script: "{{role_path}}/scripts/old_vol_rm.sh"
79 creates: /etc/partfs_rootdisk_created
81 - name: get volume groups
82 shell: "vgs -o vg_name --noheadings | sed 's/ //g'"
83 register: volumegroups
87 msg: "volume groups: {{ volumegroups.stdout_lines }}"
89 - name: get volume pools
90 shell: dmsetup ls | awk '{print $1}'
91 register: volume_pools
95 msg: "volume pools: {{ volume_pools.stdout_lines }}"
97 - name: remove old volume groups
98 include: remove_old_instance_vg.yml
100 - name: delete temporary partition
102 device: "{{root_disk}}"
103 number: "{{ sys_part_number|int + 1 }}"
105 when: delete_partition is defined
107 - name: configure root volume groups
108 include: root_disk_volume_groups.yml
110 create_disk_part: True
112 - name: configure instance disk partition
114 device: "{{root_disk}}"
115 number: "{{instance_part_number}}"
116 part_start: "{{instance_part_start}}GB"
119 when: rootdisk_vg_percentage != all_disk_size_for_volume_group_vg
121 - name: remove old volume groups
122 include: remove_old_instance_vg.yml
124 - name: create /etc/partfs_rootdisk_created file
125 command: touch /etc/partfs_rootdisk_created
127 creates: /etc/partfs_rootdisk_created