0

我正在尝试从 AWX 的 ansible-playbook 运行 nodejs 脚本。该命令在常规 cli 中运行良好,但是当我从 playbook 运行它时它失败了!

版本:

ansible 2.5.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15+ (default, Nov 27 2018, 23:36:35) [GCC 7.3.0]

这是剧本的最新线索:

---
- name: create a new domain in Digital Ocean.
  hosts: localhost
  connection: local
  tasks:
  - name: create a new domain in Digital Ocean.
    shell: "/var/lib/awx/projects/MY_USERNAME/modules/new-domain.js --name={{client_url|quote}} --ip={{server_ip|quote}}"
    args:
      executable: /usr/bin/node

谢谢你

4

1 回答 1

0

这个executable论点实际上改变了你的外壳,这不是你想要做的。试试看嘛:

  tasks:
  - name: create a new domain in Digital Ocean.
    shell: "/usr/bin/node /var/lib/awx/projects/MY_USERNAME/modules/new-domain.js --name={{client_url|quote}} --ip={{server_ip|quote}}"
于 2019-08-05T04:09:36.283 回答