AirNet使用笔记3

一万年来谁著史,三千里外欲封侯。这篇文章主要讲述AirNet使用笔记3相关的知识,希望能为你提供帮助。
1、问题:“升级工具”某替换后的主机status为OFFLINE,Update操作失败。-m:要使用的模块名称;-a,--args:模块所需的参数;-i自定义hosts清单。
正常情况如下:

[root@DBM1 InstallTK]# ansible SMC1 -m setup -i playbooks/hosts_ansible -a filter=ansible_product_name
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this
will change, but still be user configurable on deprecation. This feature will be removed in version 2.10. Deprecation warnings can
be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.7.31 | UNREACHABLE! =>
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.7.31 port 22: No route to host",
"unreachable": true

192.168.6.31 | UNREACHABLE! =>
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.6.31 port 22: No route to host",
"unreachable": true

192.168.5.31 | SUCCESS =>
"ansible_facts":
"ansible_product_name": "VMware Virtual Platform",
"discovered_interpreter_python": "/usr/bin/python"
,
"changed": false

ansible配置清单,用[]指定分组名,
[root@DBM1 playbooks]# more hosts_ansible
; ; auto create ansible hosts by cdatc_create_ansible_hosts
[all:vars]
ansible_ssh_user=root
ansible_ssh_pass=111111
[SMC1]
192.168.7.31
192.168.6.31
192.168.5.31

报错信息:
/root/.ssh/known_hosts:11\\r\\nPassword authentication is disabled

sshpass里面匹配的是替换之前的smc主机,把/root/.ssh/known_hosts对应记录删除OK。
【AirNet使用笔记3】*Ansible是无客户端Agent的,所以无需在客户机上安装或配置任何程序,就可以运行Ansible任务。但是需要客户端安装Python。Ansible使用SSH协议在管理机和客户机之间进行通信。可以使用SFTP与客户机进行安全的文件传输。

    推荐阅读