3 minute read

A special shout out goes to JJ Asghar (IBM) and his coredns-playbook as it was a perfect starting point for a basic Ansible playbook.

This is a follow up on my previous post, “Install Information Server”, where I wrote my first Ansible playbook to automate the installation of Information Server Even though I had been exposed to Ansible for quite some time I had never had the need to create or run any jobs myself. I figured this was a good opportunity to get my hands dirty.

Usual disclaimer: This document is for my own purpose to refer back to but if you find it useful then please let me know.


Install Ansible

brew install ansible

Install two other collections:

ansible-galaxy collection install community.general
ansible-galaxy collection install ansible.posix

Writing the playbook

I’ll post the main playbook here but check out the repo below for the other required files that store variables and includes a response file for IIS.

The latest version of the playbook is available here:


- name: Install DataStage
  hosts: all

    - name: Fetch the variables from var file
        file: ../vars/main.yml

    - name: Install DataStage dependencies
          - unzip
          - ...
          - grep
        state: present

    - name: Upgrade all packages
        name: '*'
        state: latest

    - name: Copy license files
        src: "IS_V11711_EE_bundle_spec_file.zip"
        dest: /opt/IS_V11711_EE_bundle_spec_file.zip
        force: no

    - name: Copy install files
        src: "IS_V11711_Linux_x86_multi.tar.gz"
        dest: /opt/IS_V11711_Linux_x86_multi.tar.gz
        force: no

    - name: Unarchive the install files
        src: /opt/IS_V11711_Linux_x86_multi.tar.gz
        dest: /opt
        remote_src: yes

    - name: Unarchive the license file
        src: /opt/IS_V11711_EE_bundle_spec_file.zip
        dest: /opt/is-suite
        remote_src: yes

    - name: Disable SELinux
        state: disabled

    - name: Increase msgmax
        name: kernel.msgmax
        value: "65536"

    - name: Increase msgmnb
        name: kernel.msgmnb
        value: "65536"

    - name: Increase kernel semaphores
        name: kernel.sem
        value: "250 256000 32 1024"

    - name: Increase number of open files
        domain: root
        limit_type: "-"
        limit_item: nofile
        value: "65535"

    - name: Increase ulimit
      shell: ulimit -n 65535

    - name: Copy over config file
        src: ../templates/responsefile.txt
        dest: /opt/is-suite

    - name: Run pre-check
        cmd: ./setup -reportOnly -rsp responsefile.txt
        chdir: /opt/is-suite/

    - name: Run installer
        cmd: ./setup -rsp responsefile.txt -verbose
        chdir: /opt/is-suite/

The output

$ datastage-playbook ansible-playbook -i hosts -u root -k playbook/main.yaml

PLAY [Install DataStage] ************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************
ok: [169.x.y.z]

TASK [Fetch the variables from var file] ********************************************************************************************
ok: [169.x.y.z]

TASK [Install DataStage dependencies] ***********************************************************************************************
ok: [169.x.y.z]

TASK [Upgrade all packages] *********************************************************************************************************
ok: [169.x.y.z]

TASK [Copy license files] ***********************************************************************************************************
ok: [169.x.y.z]

TASK [Copy install files] ***********************************************************************************************************
ok: [169.x.y.z]

TASK [Unarchive the license file] ***************************************************************************************************
ok: [169.x.y.z]

TASK [Disable SELinux] **************************************************************************************************************
[WARNING]: SELinux state change will take effect next reboot
ok: [169.x.y.z]

TASK [Increase msgmax] **************************************************************************************************************
ok: [169.x.y.z]

TASK [Increase msgmnb] **************************************************************************************************************
ok: [169.x.y.z]

TASK [Increase kernel semaphores] ***************************************************************************************************
ok: [169.x.y.z]

TASK [Increase number of open files] ************************************************************************************************
ok: [169.x.y.z]

TASK [Increase ulimit] **************************************************************************************************************
changed: [169.x.y.z]

TASK [Copy over config file] ********************************************************************************************************
ok: [169.x.y.z]

TASK [Run pre-check] ****************************************************************************************************************
changed: [169.x.y.z]

TASK [Run installer] ****************************************************************************************************************

changed: [169.x.y.z]

PLAY RECAP **************************************************************************************************************************
169.x.y.z              : ok=16   changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

What did I learn?

That I should have learned Ansible a lot sooner. It was very easy to get up and running. The piece-meal nature of the playbook made it easy to comment out sections, clean up the remote machine, and run again until I got it right.

The one tricky part was finding out how to increase the number of open files allowed on the system. The community.general.pam_limits did the heavy lifting but I did need to re-run the ulimit -n 65535 command afterwards.


I’m glad I got this done as it looks like I’ll have to spin up a few of these servers in the coming weeks.