I'm creating a script that dynamically generates a response file for an 
uninstall and stores the response file in a var for reuse in the uninstall 
command. My play :

=============================================
- name:  UnInstall Oracle
  hosts: localhost
  tags: oracle
  become: yes
  become_method: sudo

  tasks:
  - name: Generate Response File for Uninstall
    command: /bin/sh -c  "/opt/oracle/product/12.1.0/deinstall/deinstall 
-silent -checkonly"
    register: result
    become: true
    become_user: orclient
    become_method: sudo

  - name: Set Response Variable - respfile
    set_fact:
      respfile: "{{ result.stdout | regex_search(regexp,'\\1') }}"
    vars:
      regexp: 'Location of response file generated...([^"]+rsp)'

#  - name: Debug
#    debug:
#      var: respfile
      
  - name: Uninstall old oracle client
    command: /bin/sh -c "/opt/oracle/product/12.1.0/deinstall/deinstall 
-silent -paramfile {{ respfile }}"
    become: true
    become_user: orclient
    become_method: sudo

=============================================

My debug task when run prints as follows:

TASK [Debug] 
***************************************************************************************************************
ok: [localhost] => {
    "respfile": [
        
"/tmp/deinstall2019-11-19_11-29-40AM/response/deinstall_OraClient12Home1.rsp"
    ]
}


And my uninstall task fails with error message:


fatal: [localhost]: FAILED! => {"changed": true, "cmd": 
"/opt/oracle/product/12.1.0/deinstall/deinstall -silent -paramfile 
[u'/tmp/deinstall2019-11-19_11-35-44AM/response/deinstall_OraClient12Home1.rsp']",
 


The error shows added characters to the response file path and that causes 
it to fail. 

How can i make the response file appear without the added characters?

-- 
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/afeeebb5-d1ad-4576-9fad-2d6e3795ec3d%40googlegroups.com.

Reply via email to