Posted similar in 
https://stackoverflow.com/questions/59507221/ansible-2-7-hang-during-shell-execution-on-pl-sql

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 playbooks 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?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d5e01c7b-962d-4b3f-b2d6-325ef5710a7d%40googlegroups.com.

Reply via email to