# 检查配置文件 ansible-playbook --syntax-check nginx_install.yaml # -C 模拟执行 ansible-playbook -C nginx_install.yaml # 练习-1 # ansible playbook - hosts: web tasks: - name: Install Nginx Server yum: name: - nginx - lrzsz state: installed - name: Configure copy: src: ./nginx.conf dest: /etc/nginx/nginx.conf notify: Restart Nginx Server - name: Start Nginx Server service: name: nginx state: started enabled: yes handlers: - name: Restart Nginx Server service: name=nginx state=restarted ~ ~