Hello @khokha !
As @TM mentioned , you need to use the ingredients modules for creating a LVM one by one :
1. parted to create partition with flags : [lvm]
2. lvg to create vol group.
3. lvol to create lv
4. file to create the mount point
5. filesystem to format the LVM with filesystem
6. mount to mount the LVM to the directory
Refer the lvol module here : https://docs.ansible.com/ansible/latest/collections/community/general/lvol_module.html
lvg module : https://docs.ansible.com/ansible/latest/collections/community/general/lvg_module.html
Hello,
You can still use the ansible.builtin.command module.
But you might need to take extra steps and actions to ensure idempotency and "changed" status.
Regards,
Tshimanga
Hello @khokha !
As @TM mentioned , you need to use the ingredients modules for creating a LVM one by one :
1. parted to create partition with flags : [lvm]
2. lvg to create vol group.
3. lvol to create lv
4. file to create the mount point
5. filesystem to format the LVM with filesystem
6. mount to mount the LVM to the directory
Refer the lvol module here : https://docs.ansible.com/ansible/latest/collections/community/general/lvol_module.html
lvg module : https://docs.ansible.com/ansible/latest/collections/community/general/lvg_module.html
I'm having know problem with artifacts of lv , lets say that i want to create lv:lv1 if vg:vg1 exists , how can i write that in terms of ansible_facts?
i tried in the lab environment ansible_lvm['vgs'] it worked but on my personal lab it doesn't work.
another one, lets say if i want to format the lv:lv1 with xfs only if lv1 exists, how can i write this too in terms of ansible_facts?
Thanks in advance
Hello!
Does EX294 allow the usage of the community.general?
Whatever you need for the exam will be provided - donot worry about it.
Hello,
Certainly! To create a Logical Volume (LV) in RHEL 9 using Ansible without using roles, you can utilize the Ansible module called "lvol." This module allows you to define LV properties in your playbook directly, avoiding the need for roles. Simply specify the LV details like name, size, and VG (Volume Group) in your playbook's tasks.
Regards,
Lily
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.