为什么命令模块挂起 psql 的 ansible?
Why does command module hang for ansible for psql?
当我在我的剧本中发出这样的 psql
命令时:
- name: Run psql to pull in initial config data
become_method: sudo
become: yes
become_user: postgres
command: psql -U postgres -w eclaim < /opt/eclaim_revamp/sql_scripts/initial_config.sql
花很长时间才完成,看起来好像挂了,但是当我使用shell
时,它可以通过:
- name: Run psql to pull in initial data
become_method: sudo
become: yes
become_user: postgres
shell: psql -U postgres -w eclaim < /opt/eclaim_revamp/sql_scripts/initial_sql_script.sql
谁能告诉我为什么?
[The given command] will not be processed through the shell, so variables like $HOME and operations like "<", ">", "|", and "&" will not work (use the shell module if you need these features).
当我在我的剧本中发出这样的 psql
命令时:
- name: Run psql to pull in initial config data
become_method: sudo
become: yes
become_user: postgres
command: psql -U postgres -w eclaim < /opt/eclaim_revamp/sql_scripts/initial_config.sql
花很长时间才完成,看起来好像挂了,但是当我使用shell
时,它可以通过:
- name: Run psql to pull in initial data
become_method: sudo
become: yes
become_user: postgres
shell: psql -U postgres -w eclaim < /opt/eclaim_revamp/sql_scripts/initial_sql_script.sql
谁能告诉我为什么?
[The given command] will not be processed through the shell, so variables like $HOME and operations like "<", ">", "|", and "&" will not work (use the shell module if you need these features).