Ansible-playbook 拾遺
阿新 • • 發佈:2018-01-09
res name star gin playbook check art -i --
ansible-playbook 和handles 一起使用
--- - hosts: web user: root tasks: - name: ensure nginx is at the latest version yum: name=nginx state=latest - name: Copy nginx.conf copy: src="/root/nginx.conf" dest="/etc/nginx/nginx.conf" notify: - Restart Nginx service handlers: - name: Restart Nginx service service: name=nginx state=restarted
檢查 ansible-playbook 配置文件是否正確
ansible-playbook nginx.yml --check
執行 playbook
ansible-playbook nginx.yml
檢查nginx 服務是否正確安裝
ansible -i /etc/ansible/hosts web -m shell -a 'netstat -tpln |grep :800'
Ansible-playbook 拾遺