假设我有这个 Ansible 任务:
- name: Run ETL 2
shell: psql -U {{dbuser}} -d {{dbname}} -f /tmp/data-cleansing2.sql
sudo_user: postgres
我有很多这样的,我首先要上传文件
- name: Upload ETL script
copy: src=../data-cleansing2.sql /tmp/data-cleansing2.sql
如果有办法告诉 ansible 它必须首先上传文件,那就太好了,例如:
- name: Run ETL 2
shell: psql -U {{dbuser}} -d {{dbname}} -f {{/abc/xyz.sql | upload_file}}
sudo_user: postgres