查看模块详细参数及其案例 [root@localhost .ssh]# ansible-doc user 常用模块 命令执行模块 一共有四种模块: command shell raw script command 通过执行ansible-doc command 可以看到,conmmand模块的使用跟正常shell命令差别不大。 [root@localhost ~]# ansible all -m command -a 'touch /opt/file1' [WARNING...
become: yes #2.6版本以后的参数,之前是sudo,意思为切换用户运行 become_user: mysql #指定sudo用户为mysql 二.tasks列表和action Play的主体部分是task列表,task列表中的各任务按次序逐个在hosts中指定的主机上执行,即在所有主机上完成第一个任务后再开始第二个任务。在运行playbook时(从上到下执行),如果一个host...