-1

when running yml file, commands containing backslash return syntax error

Is there a way of running commands using backslash?

e.g.

- name: 
  hosts: 
  tasks:
    - postgresql_query:
       ...
       path_to_script: db.sql


db.sql
...
\c db
1
  • It seems that your problem description is missing significant parts of important information. Commented Oct 21, 2021 at 6:36

1 Answer 1

1

According the documentation of postgresql_query there is a parameter db

- name: Run pgsql queries from script
  postgresql_query:
    db: <Name of database to connect to and run queries against>
    path_to_script: <path to a SQL script on the target machine>

with which you connect to a database and then run queries from a SQL script.

According your problem description it seems that you try to connect to a database from within a SQL script.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.