Ansible实现剧本远程服务器创建、删除用户
创建用户剧本user_add.yaml
- hosts: 192.168.45.135
remote_user: root
tasks:
- name: linux system add user list.
user: name={{ item }} state=present
with_items:
- xiaoxin1
- xiaoxin2
- xiaoxin3
- xiaoxin4
删除用户剧本user_delete.yaml
- hosts: 192.168.45.135
remote_user: root
tasks:
- name: linux system add user list.
user: name={{ item }} state=absent
with_items:
- xiaoxin1
- xiaoxin2
- xiaoxin3
- xiaoxin4
执行脚本命令
ansible-playbook user_delete.yaml
执行结果
登录135服务器查看创建删除成功
原文地址:https://blog.csdn.net/weixin_43819738/article/details/142629192
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!