1

I have the following setup:

test.sql:

show pdbs;

sample.yml (playbook):

---
- name: Run SQL test
  hosts: database_hosts
  connection: ssh
  gather_facts: no

  vars:
    - ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
    - oracle_work_dir: '/tmp/debugansible/'

  tasks:

    - name: Creates script directory
      file:
        path: "{{ oracle_work_dir }}"
        state: directory

    - name: Create the script in the SQL folder
      copy:
        src: "{{ base }}/{{ item }}"
        dest: "{{ oracle_work_dir }}/{{ item }}"
        force: yes
      with_items:
        - test.sql

    - name: Test run
      shell: "sqlplus / as sysdba @{{ oracle_work_dir }}/{{ item }}"
      with_items:
        - test.sql

    - debug: msg="Finished looo"

Python version on remote and host: 2.7.5

Command to execute the playbook:

ansible-playbook -i uat -e base=$(pwd) -e ansible_ssh_private_key_file=$(pwd)/oracle.key sample.yml -v

Using ansible 2.4 up till 2.6, playbook executed successfully.

However, with ansible 2.7 and onwards, execution hanged at the task "Test Run". Output in debug mode, this is where it stopped:

  1449 1577492368.33784: _low_level_execute_command() done: rc=0, stdout=, stderr=
  1449 1577492368.33789: _low_level_execute_command(): starting
  1449 1577492368.33802: _low_level_execute_command(): executing: /bin/sh -c '/usr/bin/python /home/oracle/.ansible/tmp/ansible-tmp-1577492368.0-8244942626565/AnsiballZ_command.py && sleep 0'

Somehow if test.sql are tweaked by appending EXIT, the execution will went fine. test.sql (modified):

show pdbs;
EXIT

Has anyone encounter this before? Tested similar behaviour up till latest ansible 2.9.

There are bundle of playbook having these issue now after we upgraded from 2.4 to 2.7. Is there some configuration which can be applied to make it compatible again?

0 Answers0