我正在尝试使用ANSIBLE执行bashrc函数“ enableSsh”。我正在使用下面的ANSIBLE代码来完成此操作,但出现错误:找不到enableSsh命令。
- name: Switch to user root and enable ssh
become: yes
become_user: root
become_method: su
shell: . .bashrc && enableSsh
args:
executable: /bin/bash
注意::我测试了删除enableSsh并重新加载bashrc的效果很好。 enableSsh是在远程服务器的bashrc文件中定义的功能,如果直接从命令行执行,则可以正常工作。