1. 程式人生 > >ansible - roles(高級運維)

ansible - roles(高級運維)

templates task red div sgi span name yml root

/root

  /roles

  web.yml

    /web ansible的一個組

      /files

      /handlers

      /tasks(必須有)

        installmariadb.yml

        installnginx.yml

        installuwsgi.yml

        installredis.yml

        main.yml

      /templates

      /vars

web.yml

- hosts: web
  remote_user: root
  roles:
  - web

installmariadb.yml

- name: installmariadb
  yum: name=mariadb 

installnginx.yml

- name: installnginx
  yum: name=nginx

installuwsgi.yml

- name: installuwsgi
  yum: name=uwsgi

installredis.yml

- name: installredis
  yum: name=redis

main.yml

- import_tasks: installnginx.yml
- import_tasks: installuwsgi.yml
- import_tasks: installmariadb.yml - import_tasks: installredis.yml

ansible - roles(高級運維)