Hi,
I haven’t followed all the code . But not sure why do you need double
quotes in join


* joined_ts_list: |-      {{ user_def_tablespace | join(',') | string}}*



On Fri 21. May 2021 at 15:25, Pourab Bhattacharyya <[email protected]>
wrote:

>
> Hi,
>
> I'm trying to database query by ansible postgresql_query module. I'm using
> positional_args parameter for dynamically sending database parameter value.
>
> This my ansible block:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *- set_fact:     when: inventory_hostname in groups ['edbmaster'] and
> user_def_tablespace is defined- name: Check the tablespace details
> postgresql_query:    db: "{{ edb_databasename }}"    port: "{{ DB_PORT
> }}"    login_unix_socket: /tmp    login_user: "{{ edb_user }}"    query:
> select spcname,pg_tablespace_location(oid) from pg_tablespace where spcname
> in (%s)    positional_args:    - '{{ joined_ts_list }}'  when:
> inventory_hostname in groups ['edbmaster'] and user_def_tablespace is
> defined  register: pg_query_op- name: Tablespace status details  debug:
> msg: "{{ pg_query_op.query }}"  when: inventory_hostname in groups
> ['edbmaster'] and user_def_tablespace is defined*
>
> Here user_def_tablespace is list variable in my variable file.
>
>
>
> *user_def_tablespace:  - data_tbspc  - index_tbspec*
>
> My issue is that the variable names having extra single quotes when I'm
> passing it as an argument but during the set_fact there is no extra double
> quote. Like below
>
> TASK [extra_user_def_taks : debug]
> **************************************************************************************************************************
> ok: [10.174.131.31] => {
>     "msg": "data_tbspc','index_tbspec" ---> only one single quote
> }
> TASK [extra_user_def_taks : Tablespace status details]
> ******************************************************************************************************
> ok: [10.174.131.31] => {
>     "msg": "select spcname,pg_tablespace_location(oid) from pg_tablespace
> where spcname in ('data_tbspc*'',''*index_tbspec')" ---> Extra single
> quote is appending
> }
>
> I'm not able to debug this issue. Hope I'm clear with my problem.
> Need your expert advise to resolve this problem.
>
> *Thanks,*
> *Pourab*
>
> --
> 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/683a9d3d-1732-44a3-b6ad-2350458355e5n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/683a9d3d-1732-44a3-b6ad-2350458355e5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAJ%2BRxtQQFa75eRZkBzKKqqZosdsO%2BCZp%2BcZ%3D1gf69HxnESBZpQ%40mail.gmail.com.

Reply via email to