环境:
client centos
server ubuntu
cat pro1.yml
---
- hosts: www.test.comtasks:- name: Install Httpd Serverapt: name=apache2 state=present- name: Configurate Httpd Servercopy: content="I'am client" dest=/var/www/html/index.html- name: Start Httpd Serverservice: name=apache2 state=started enabled=yes
模拟执行:
ansible-playbook -C pro1.yml
执行:
ansible-playbook pro1.yml
server:
验证登录: