1、以all主机组为目标执行id命令
2、使用copy模块修改所有主机上的/etc/motd文件内容为welcome to ansible
3、使用command模块查看/etc/motd文件的内容
4、使用user模块创建用户wukong,uid为2000
5、使用yum模块安装httpd软件包并使用service模块启动该服务
1.以all主机组为目标执行id命令
[ xiaobai@centos8master ~] $ ansible all -m command -a ‘id’
2.使用copy模块修改所有主机上的/etc/motd文件内容为welcome to ansible
[ xiaobai@centos8master ~] $ ansible all -m copy -a ‘content= “welcome to ansible\ n” dest = /etc/motd’
3.使用command模块查看/etc/motd文件的内容
[ xiaobai@centos8master ~] $ ansible all -m command -a ‘cat /etc/motd’
4.使用user模块创建用户wukong,uid为2000
[ xiaobai@centos8master ~] $ ansible all -m user -a ‘name= wukong uid = 2000 ’
5.使用yum模块安装httpd软件包并使用service模块启动该服务
[ xiaobai@centos8master ~] $ ansible all -m yum -a ‘name= httpd’
[ xiaobai@centos8master ~] $ ansible all -m service -a ‘name= httpd state = started’