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: check if this is partfs_rootdisk re-run
19 path: /etc/partfs_rootdisk_created
23 - name: Create /tmp/<node_name>localstorage.json file
25 src: "localstorage.j2"
26 dest: "/tmp/{{inventory_hostname}}_localstorage.json"
29 delegate_to: "{{installation_controller}}"
31 - name: Load variables from the json file
32 include_vars: "/tmp/{{inventory_hostname}}_localstorage.json"
34 - name: Remove /tmp/<node_name>localstorage.json file
36 path: "/tmp/{{inventory_hostname}}_localstorage.json"
38 delegate_to: "{{installation_controller}}"
40 - name: Create Partition for LVMs
42 device: "{{root_disk}}"
43 number: "{{phy_disk_part_number}}"
46 part_start: "{{part_start}}"
47 part_end: "{{part_end}}"
49 - create_disk_part | bool
50 - rootdisk_vg_percentage != all_disk_size_for_volume_group_vg
52 - name: Create Partition for LVMs
54 device: "{{root_disk}}"
55 number: "{{phy_disk_part_number}}"
58 part_start: "{{part_start}}"
60 - create_disk_part | bool
61 - rootdisk_vg_percentage == all_disk_size_for_volume_group_vg
64 vg_disk: "{% if root_disk == default_rootdisk_device %}{{root_disk}}{{phy_disk_part_number}}{% else %}{{root_disk}}-part{{phy_disk_part_number}}{% endif %}"
74 - name: Delete old LVMs if not mounted already
75 script: "{{role_path}}/scripts/old_vol_rm.sh"
77 creates: /etc/partfs_rootdisk_created
82 lv: "{{vol['lvm_name']}}"
83 size: "{{vol['lvm_size']}}"
84 with_items: "{{device_mapping|sort(attribute='mount_point')}}"
88 - rerun_case.stat.exists is undefined or rerun_case.stat.exists == false
90 - name: Create XFS filesystem on LVM
93 dev: "/dev/mapper/VG-{{vol['lvm_name']}}"
94 with_items: "{{device_mapping|sort(attribute='mount_point')}}"
98 - name: Create fstab entry.
100 path: "{{vol['mount_point']}}"
101 src: "/dev/mapper/VG-{{vol['lvm_name']}}"
103 opts: "{{vol['mount_opts']}}"
105 with_items: "{{device_mapping|sort(attribute='mount_point')}}"
109 # Run below script to do the following tasks
110 #- Stop existing services
111 #- Move the current files to a tmp location
112 #- mount LVM on mount dir
114 #- Start old services
115 #- It creates logs in the target node at /tmp/vol_mgmt_logfile
116 - name: Running a script to remount volume on target dir
117 script: "{{role_path}}/scripts/vol_mgmt.sh {{vol['mount_point']}} /dev/mapper/VG-{{vol['lvm_name']}}"
118 with_items: "{{device_mapping|sort(attribute='mount_point')}}"
122 creates: /etc/partfs_rootdisk_created
124 - name: Check if Root partition can grow
125 shell: "growpart --dry-run $(readlink -f {{root_disk}}) 1"
129 creates: /etc/partfs_rootdisk_created
131 - name: Grow Root partition
132 shell: "growpart $(readlink -f {{root_disk}}) 1"
133 when: rootpart.rc == 0
135 creates: /etc/partfs_rootdisk_created
137 - name: Grow xfs filesystem on Root partition
138 command: "xfs_growfs /"
140 creates: /etc/partfs_rootdisk_created