运维自动化工具-ansible几个小案例
1.4 检查yaml文件的语法是否正确
$ ansible-playbook -i /tmp/hosts nginx.yaml --syntax-check
1.5 检查yaml文件中的tasks任务
$ ansible-playbook -i /tmp/hosts nginx.yaml --list-task
1.6 检查yaml文件中的生效主机
$ ansible-playbook -i /tmp/hosts nginx.yaml --list-hosts
1.7 运行playbook
$ ansible-playbook -i /tmp/hosts nginx.yaml
1.8 运行playbook里面特定的某个task,从某个task开始运行
$ ansible-playbook -i /tmp/hosts nginx.yaml --start-at-task='Copy Nginx.conf'
1.9 验证登录命令
ansible -i /data/ld_fabu/ansible_cfg/hosts online -m shell -a 'cd /tmp; ls'
标签:tmp,运维,yaml,案例,ansible,hosts,playbook,nginx From: https://blog.csdn.net/lisanmengmeng/article/details/143402071