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: "{{lvm_part_number}}"
45 label: "{{root_disk_info.disk.table}}"
48 part_start: "{{lvm_part_start}}GB"
49 part_end: "{{lvm_part_end}}GB"
51 - create_disk_part | bool
54 vg_disk: "{% if root_disk == default_rootdisk_device %}{{root_disk}}{{lvm_part_number}}{% else %}{{root_disk}}-part{{lvm_part_number}}{% endif %}"
64 - name: Delete old LVMs if not mounted already
65 script: "{{role_path}}/scripts/old_vol_rm.sh"
67 creates: /etc/partfs_rootdisk_created
72 lv: "{{vol['lvm_name']}}"
73 size: "{{vol['lvm_size']}}"
74 with_items: "{{device_mapping|sort(attribute='mount_point')}}"
78 - rerun_case.stat.exists is undefined or rerun_case.stat.exists == false
80 - name: Create XFS filesystem on LVM
83 dev: "/dev/mapper/VG-{{vol['lvm_name']}}"
84 with_items: "{{device_mapping|sort(attribute='mount_point')}}"
88 - name: Create fstab entry.
90 path: "{{vol['mount_point']}}"
91 src: "/dev/mapper/VG-{{vol['lvm_name']}}"
93 opts: "{{vol['mount_opts']}}"
95 with_items: "{{device_mapping|sort(attribute='mount_point')}}"
99 # Run below script to do the following tasks
100 #- Stop existing services
101 #- Move the current files to a tmp location
102 #- mount LVM on mount dir
104 #- Start old services
105 #- It creates logs in the target node at /tmp/vol_mgmt_logfile
106 - name: Running a script to remount volume on target dir
107 script: "{{role_path}}/scripts/vol_mgmt.sh {{vol['mount_point']}} /dev/mapper/VG-{{vol['lvm_name']}}"
108 with_items: "{{device_mapping|sort(attribute='mount_point')}}"
112 creates: /etc/partfs_rootdisk_created
114 - name: Check if Root partition can grow
115 shell: "growpart --dry-run $(readlink -f {{root_disk}}) 1"
119 creates: /etc/partfs_rootdisk_created
121 - name: Grow Root partition
122 shell: "growpart $(readlink -f {{root_disk}}) 1"
123 when: rootpart.rc == 0
125 creates: /etc/partfs_rootdisk_created
127 - name: Grow xfs filesystem on Root partition
128 command: "xfs_growfs /"
130 creates: /etc/partfs_rootdisk_created