随笔分类 - ansible
摘要:前文讲了ansible,但是ansible是基于ssh来做的,首先的和管理主机之间做主机互信,简单来说主机互信就是把主机上产生的公钥传到互信主机上就可以了。 在主机上产生公钥文件。使用命令:ssh-keygen 然后把产生的公钥传到需要做互信的主机上。 公钥的位置: 使用命令ssh-copy-id进
阅读全文
摘要:cron模块 管理远程主机上的计划任务 [root@tiandong ansible]# ansible all -m cron -a "name='cron test' minute=5 hour=1 job='echo test'" 每天1点5分执行 [root@tiandong ansible
阅读全文
摘要:Command模块 在远程节点上执行命令 [root@tiandong ~]# ansible all -m command -a "ls" 在远程主机上执行ls命令。 [root@tiandong ~]# ansible all -m command -a "chdir=/tmp ls" 进入到/
阅读全文
摘要:ansible中定义变量可以使用vars关键字,变量由字母、数字、下划线组成,开头必须是字母。 先看一个简单的事例 [root@tiandong tiandong]# vim var.yml hosts: all vars: testvar1: testfile remote_user: root
阅读全文
摘要:Ansible常用模块文件操作 [root@tiandong etc]# ansible-doc -l 列出ansible所支持的模块 [root@tiandong ~]# ansible-doc -s ping(模块名) 可以查看模块的详细信息 Ping模块 [root@tiandong ~]#
阅读全文

浙公网安备 33010602011771号