我的剧本:
- name: get junos facts
hosts: sw
# connection: local
gather_facts: no
roles:
- juniper.junos
tasks:
- name: Retrieve Junos OS version
junipernetworks.junos.junos_command:
commands: show version
东道主:
[sw]
EX4200-2
EX4200-1
vars:
ansible_network_os: juniper_juno
我正在角色内部开发一个ansible模块(即模块位于角色的library目录中)。我想知道是否可以在模块中排队处理程序?
下面是我想要做的事情的一个例子,但是没有在任务上使用notify位。
- name: build and install my application
custom_module:
path=/opt/web_app
notify:
- restart web server
理想情况下,我希望以某种方式将custom_module队列放到处理程序中,以便使用如下所示:
- name: build and install my application
在ansible文档中,有人说:
不可靠..。它还将在“./library”目录中和一个剧本一起查找模块。
在我的情况下,gaqzi.ssh-config提供的指令被ansible看到的唯一方法是显式地导出带有完整路径的ANSIBLE_LIBRARY ;(
没有该gaqzi.ssh-config模块,ansible就找不到它应该使用的文档。
在这里,我要做的是让它发挥作用:
$ cd playbook # my folder were the plabooks are
$ ansible-galaxy install -p library gaqzi.ssh-config # I
我正在编写安装通用转发器的ansible脚本,但仍然使用pexpect模块。
我正在收到的错误:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'pexpect'
fatal: [Server-a]: FAILED! => {"changed": false, "msg": "Failed to import th
我已经开发了一个自定义的ansible模块,它依赖于第三方的库PyYAML。然而,运行攻略会产生以下结果 ansible_module_my_module.py, line 5, in <module>
import yaml
ImportError: No module named yaml 我在ansible requirements.txt (https://github.com/ansible/ansible/blob/stable-2.8/requirements.txt)中看到PyYAML,因此我知道它在主机上安装/使用。我想知道有没有推荐的方法在远程机器上安装它