Using Ansible role to setup Oracle ACFS on multiple nodes

1 min read
Aug 28, 2018

This post contains step by step instructions for creating an Ansible role acfssetup to setup Oracle ASM Cluster Filesystem (ACFS) on multiple nodes of a cluster. This assumes that Grid Infrastructure is already installed on the nodes, and ASM is working fine. This also assumes that there already is Ansible installed on some controller host with ssh equivalency setup between root and Oracle users. Step 1: Create directory structure for the role acfssetup: [code] $ cd /etc/ansible/roles $ mkdir acfssetup $ mkdir files handlers meta templates tasks vars [/code] Step 2: Create the tasks (/etc/ansible/roles/acfssetup/tasks/main.yml): [code] --- - name: Install ACFS/ADVM modules on the nodes become_user: "" environment: "" shell:"{ gi_home_path }}/bin/acfsroot install" tags:acfs - name: Start and enable the ACFS modules on the nodes become_user: "" environment: "" shell:"{ gi_home_path }}/bin/acfsload start" shell:"{ gi_home_path }}/bin/acfsroot enable" tags:acfs - name: As oracle user, create an ASM volume for ACFS on first node when: inventory_hostname in groups['node1'] become_user: "" environment: "" shell:"{ gi_home_path }}/bin/asmcmd volcreate -G -s " shell:"{ gi_home_path }}/bin/asmcmd volinfo -G | grep Device | sed 's/.*://'" register: tags:acfs - name: As oracle user, create the filesystem on the volume which was just created become_user: "" environment: "" shell:"/sbin/mkfs -t acfs .stdout" tags:acfs - name: As root, create an empty directory which will house the file system become_user: "" environment: "" shell:"mkdir -p //; chown root:oinstall /; chmod 770 /; chown -R oracle:oinstall //; chmod 775 //" tags:acfs - name: As root, setup the file system to be auto mounted by clusterware become_user: "" environment: "" shell:"{ gi_home_path }}/bin/srvctl add volume -volume -diskgroup -device .stdout; { gi_home_path }}/bin/srvctl add filesystem -device .stdout -path / -diskgroup -user -fstype ACFS -description \"ACFS General Purpose Mount\"" tags:acfs [/code] Step 3: Create the variables (/etc/ansible/roles/acfssetup/vars/main.yml): [code] ver: "" superuser: root asm_instance: +ASM asm_dg_name: DATA acfs_vol_name: ACFSVOL1 acfs_vol_size: 10G acfs_mount_name: acfsmounts device_name: default([]) gi_owner: oracle gi_group: oinstall gi_base_path: "/u01/app/oracle" gi_home_path: "/product//grid" gi_home_name: "OraGI" [/code] Step 4: Configure Ansible host file (/etc/ansible/hosts) [code] node1 node2 [/code] Step 5: Create the skeleton playbook (/etc/ansible/acfs.yml): [code] --- - hosts: all become: true roles: - acfssetup [/code] Step 6: Run the playbook [code] $ ansible-playbook acfs.yml [/code]

Get Email Notifications

No Comments Yet

Let us know what you think