ansible

来源:互联网 发布:ubuntu中安装qq国际版 编辑:程序博客网 时间:2024/05/16 06:34
ansible <host-pattern> [-f forks] [-m module_name] [-a args]    -f forks: 启动的线程数    -m module_name: 要使用的模块    -a args: 模块特有的参数        ansible-doc -s copy        ansible-doc -l    常见模块:        command:命令模块 ,默认模块,用于在远程执行命令            ansible all -a 'date'        cron:            state:                present:安装                absent: 移除            */10 * * * /bin/echo 'hello world'            ansible web1 -m cron -a "minute='*/10' job='/bin/echo hello world' name='test cron job'" -uroot        user:            name:指明创建的用户的名字        group:            ansible web1 -m group -a 'name=test system=yes' -uroot        ansible all -m ping        ansible web1 -a 'service nginx status' -uroot        service:            enabled= : 是否是开机启动,取值为true或者false            name=: 服务名称            state=: 状态取值started,stoped,restarted        shell: 在远程主机上运行命令            尤其是用到管道等命令        script: 将本地脚本复制到远程主机并运行            注意:使用相对路径指定脚本        yum: 安装程序包        ansible all -m setup 返回主机信息        - host:webservs          remote_user:          tasks:           - task1             modulename: module_args           - task2        - host:dbservs
原创粉丝点击