覆盖剧本中的ansible可执行文件

时间:2019-04-27 23:25:33

标签: ansible ansible-2.x

我想知道是否可以覆盖剧本中executable文件中设置的ansible.cfg值。像下面这样...

---
- name: 'New Server Setup'
  hosts: 'all'
  gather_facts: false
  pre_tasks:
    - name: 'setup : installing python for ansible'
      raw: 'test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)'
      changed_when: false
    - setup: # aka gather_facts
      tags: setup
  user: root
  become: yes
  become_method: sudo
  executable: '/bin/bash'

  roles:
    - setup

我已经尝试了所有可以想到的方法,但似乎没有任何效果。

1 个答案:

答案 0 :(得分:1)

视情况而定

从版本2.1开始,可以被清单变量ansible_shell_executable覆盖。

相关问题