我的ansible服务器中有python2.7和python3.5,而它正在使用python2.7执行攻略。我想让ansible在执行攻略时使用python3.5。
in order:
1 have set export path.
2 also changed default interpreter path in ansible.cfg as well.
3 have given specific interpretor path in hostsfile for particular host.
但是,ansible仍然没有运行python3。
攻略看起来像这样:
- hosts: all
tasks:
- name: "run on all hosts,1"
shell: something1
- name: "run on all hosts,2"
shell: something2
- name: "run on one host, any host would do"
shell: this_command_should_run_on_one_host
- name: "run on all host
我有一个由ansible-playbook -u <username> -k playbooks/example.yml从命令行手动运行的ansible攻略
上面的方法运行良好。它会提示我输入SSH密码并运行攻略。
The ansible version in my linux machine: 2.7.7
作为我的构建计划的一部分,我需要在竹子中运行它。在竹子中,我不能输入密码,因为它不会提示我。所以我希望将用户名和ssh密码作为参数作为命令的一部分进行传递。
我试过了
ansible-playbook playbooks/monitor-linux-node.yml -e
首先,我看到了很多类似标签的帖子,但都没有起作用。我有一个现有的Ansible主机,我成功地使用它将软件部署到其他服务器。我想使用Vagrant设置一个测试环境,在不做任何更改的情况下运行我现有的剧本。
我已经在不同的服务器上安装了Ansible和Vagrant,并复制了playbook、inventory和group/host vars文件。
但是,当我使用Ansible (远程)配置器在Vagrant主机上运行调用剧本的vagrant up时,它在针对主机运行时会给出以下消息:
PLAY [Set fact for later use] **************************
我需要在目标机器上设置环境。环境变量位于名为.env337的文件中。该文件中有几个变量,如
export AB_HOME=/tl/dev/abinitio/abinitio-V3 #/gcc3p32 # for 32-bit
export PATH=${AB_HOME}/bin:${PATH}
我已经尝试了下面的攻略来设置环境并注册环境变量,以便在环境关键字中使用它们来在已注册的环境中运行其他命令,但它不起作用。
- hosts: dev
gather_facts: false
tasks:
- name: To set the environment
she