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