Ansible: is it possible to feed a remote task with local files (avoid first uploading the file) -
suppose have ansible task :
- name: run etl 2 shell: psql -u {{dbuser}} -d {{dbname}} -f /tmp/data-cleansing2.sql sudo_user: postgres
i have many of them these, , first have upload file
- name: upload etl script copy: src=../data-cleansing2.sql /tmp/data-cleansing2.sql
it nice if there way tell ansible must first upload file, ex:
- name: run etl 2 shell: psql -u {{dbuser}} -d {{dbname}} -f {{/abc/xyz.sql | upload_file}} sudo_user: postgres
you might want check out script
module. module runs local script on remote node after transferring it.
the script
module takes script name followed list of space-delimited arguments. local script @ path transferred remote node , executed. given script processed through shell environment on remote node.
using module, however, you'd have first add calls psql script files. see here more info.
Comments
Post a Comment