You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| script | 管理端一个脚本,然后在远程服务器上执行 |`ansible all -m script -a '/root/time.sh'`|
433
435
| file | 主要用于远程主机上的文件和目录操作 |`ansible all -m file -a "path=/root/rsync.password mode=600 state=touch"`|
434
436
| cron | 管理执行任务计划模块(增删改查) |`ansible all -m cron -a "name='test a job' user=root job='/bin/sh /server/scripts/test.sh' minute=* hour=* day=* month=* weekday=*"`|
435
-
| yum | RedHat和CentOS的软件包安装和管理 |`安装<br />ansible all -m yum -a "name=httpd state=present"<br/>ansible all -m yum -a "name=httpd state=installed"<br />卸载<br />ansible all -m yum -a "name=httpd state=absent"<br/>ansible all -m yum -a "name=httpd state=removed"`|
436
-
|service和systemd| 用于管理远程主机的服务 |`ansible all -m systemd -a "name=httpd state=started enabled=yes"<br />ansible all -m systemd -a "name=httpd state=restarted"`|
437
+
| yum | RedHat和CentOS的软件包安装和管理 | 安装<br />`ansible all -m yum -a "name=httpd state=present"`<br/>`ansible all -m yum -a "name=httpd state=installed"`<br />卸载<br />`ansible all -m yum -a "name=httpd state=absent"`<br/>`ansible all -m yum -a "name=httpd state=removed"`|
438
+
|`service`和`systemd`| 用于管理远程主机的服务 |`ansible all -m systemd -a "name=httpd state=started enabled=yes"`<br />`ansible all -m systemd -a "name=httpd state=restarted"`|
437
439
| user | useradd, userdel, usermod |`ansible all -m user -a 'name=haha remove=no state=absent'`|
438
440
| group | groupadd, groupdel, groupmod |`ansible all -m group -a 'name=mygroup state=absent'`|
439
441
| setup | 可收集远程主机的facts变量的信息 |`ansible all -m setup -a 'filter=ansible_default_ipv4'`|
440
442
| authorized_key | 为特定的用户账号添加或删除 SSH authorized keys |`ansible all -m authorized_key -a "user=root key='{{lookup('file','/root/.ssh/id_rsa.pub')}}' path=/root/.ssh/authorized_keys manage_dir=no"`|
441
443
| replace | 和 sed 命令比较类似,用于正则匹配和替换 |`ansible all -m replace -a "path=/etc/fstab regexp=^(UUID.*) replace='#\1'"`|
442
444
| lineinfile | 正则匹配,更改某个关键参数值 |`ansible all -m lineinfile -a "path=/etc/selinux/config regexp='^SELINUX=' line='SELINUX=disabled'"`|
0 commit comments