botang 发表于 2020-8-17 22:48:49

ANSIBLE ROLE我们自己的ROLE

cd ./roles
ansible-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]
查看完整版本: ANSIBLE ROLE我们自己的ROLE