ANSIBLE ROLE我们自己的ROLE
cd ./rolesansible-galaxy init myrole3
$ tree
.
├── files
│ └── index.html
├── handlers
│ └── main.yml
├── meta
├── tasks
│ └── main.yml
└── templates
└── vhosts.conf.j2
---
- name: Server3 Vhost
hosts: server3.example.com
pre_tasks:
- name: Pretasks
debug:
msg: "Web Server Configuration"
roles:
- myrole1
post_tasks:
- name: Http
copy:
src: roles/myrole1/files/index.html
dest: "/var/www/vhosts/{{ ansible_hostname }}"
- name: Http Re
file:
path: /var/www/html/index.html
state: absent
- name: Debug
debug:
msg: "web Server Configuration"
页:
[1]