Category Archives: Oracle

Ansible: yum with_items gotcha

There are a few issues raised on concerning a bug in which Ansible 2.1 reports a task to be OK when it in fact fails, although Ansible stops and the summary output reports a failed task. This is reproducible when using the yum module with a with-loop that lists RPMs for installation as shown in the example below.

 packages: ['binutils','compat-libstdc++-33','elfutils-libelf','elfutils-libelf-devel','expat','gcc','gcc-c++','glibc','glibc-common','glibc-devel','glibc-headers','libaio','libaio-devel','libgcc','libstdc++','libstdc++-devel','make','sysstat','unixODBC','unixODBC-devel','kmod-oracleasm','openssh-clients','compat-libcap1','compat-libstdc++-33']

- name: Installing oracle required RPMs..
 name: "{{ item }}"
 state: present
 - "{{ packages }}"

I stumbled across this gotcha when installing Oracle 12c Grid Infrastructure and couldn’t understand why my playbook stopped when the task execution seemingly succeeded.

I discovered the root cause by substituting a shell command to call yum.

- name: Installing oracle required RPMs..
 shell: yum install "{{ item }}"
 - "{{ packages }}"

Despite the “[WARNING]: Consider using yum module rather than running yum“, I found that a few packages in the long list of Oracle required RPMs, did not exist in the local yum repository!

The workaround

Removing the “bad” RPMS from the list, enabled the task to succeed when using the yum with_items.

The solution

Details of the permanent fix can be found here:

[contact-form][contact-field label=’Name’ type=’name’ required=’1’/][contact-field label=’Email’ type=’email’ required=’1’/][contact-field label=’Website’ type=’url’/][contact-field label=’Comment’ type=’textarea’ required=’1’/][/contact-form]