You are able to run a SQL query/statement with "echo" command by shell module for the ansible task.
# an example task for sql query/statement
- name: set default schema for user
shell: echo "ALTER ROLE alper SET SEARCH_PATH TO myschema" | psql
become: yes
become_user: postgres
Friday, 29 June 2018
benefit of "gather_facts: no" setting
If you do not need any facts for your variables, you can run your playbook more fast via gather_facts setting.
For this, just add following setting in your playbook:
# example playbook
- name: Run the role for me
hosts: my_nodes
gather_facts: no
roles:
- example-role
For this, just add following setting in your playbook:
# example playbook
- name: Run the role for me
hosts: my_nodes
gather_facts: no
roles:
- example-role
Labels:
ansible,
gather_facts
Subscribe to:
Posts (Atom)