Today we are going to create a Volume Group and a list of JFS2 filesystems programmatically using Ansible on an AIX 7.x system. Let’s not make you languish any further, here we go:
- name: Create stuffvg and its filesystems
hosts: target
remote_user: root
collections:
- ibm.power_aix
var:
prefix: "stuff"
tasks:
- name: Be sure the wanted disks are usable with a cfgmgr
ansible.builtin.shell: cfgmgr
- name: Create "{{ prefix }}vg"
ibm.power_aix.lvg:
state: present
vg_name: "{{ prefix }}vg"
pvs: hdisk1
vg_type: scalable
At this stage we already have a scalable Volume Group named stuffvg. Now, let’s add some filesystems in it but first thing first, we then need to create the jfs2log LV:
- name: Create the jfs2Log lv
aix_lvol:
vg: "{{ prefix }}vg"
lv: stuffj2log
lv_type: jfs2log
size: 128M
- name: Logform the jfs2log
ansible.builtin.shell: yes | /usr/sbin/logform -V jfs2 /dev/stuffj2log
Now we are ready to create our Logical Volumes:
- name: Create LVs
aix_lvol:
vg: "{{ prefix }}vg"
lv: "{{ item.name }}"
lv_type: "{{ item.type }}"
size: "{{ item.size }}"
loop:
- { name: 'stuff_users', type: 'jfs2', size: '20G' }
- { name: 'stuffora19c', type: 'jfs2', size: '2G' }
- { name: 'stuff_ora', type: 'jfs2', size: '3G' }
Now it’s time to create JFS2 filesystems on our freshly made LV, and to mount them:
- name: Creation of JFS2 filesystems
ibm.power_aix.filesystem:
state: present
device: "{{ item.device }}"
filesystem: "{{ item.mountpoint }}"
fs_type: jfs2
auto_mount: true
loop:
- { device: 'stuffora', mountpoint: '/home/oracle' }
- { device: 'stuff_users', mountpoint: '/home/users' }
- { device: 'stuffora19c', mountpoint: '/home/oracle/product/v19c' }
- name: Mount FS
ansible.builtin.shell: mount "{{ item }}"
with_items:
- "/home/oracle"
- "/home/users"
- "/home/oracle/product/v19c"
Last but not least, some exotic stuff to finish, as I know you are kind of that:
- name: chlv -x 3000 hd1
ibm.power_aix.lvol:
vg: rootvg
lv: hd1
extra_opts: "-x 3000"
- name: Increase size of a filesystem
ibm.power_aix.filesystem:
filesystem: /home
state: present
attributes: size=25G
And here we are. No more excuse to create twice the same FS.
I’ll see you next time.
Leave a Reply
You must be logged in to post a comment.