zoukankan      html  css  js  c++  java
  • ansible(十)roles

    1、roles:角色的集合

     1 [root@linux-node1 ~]# tree ansible/
     2 ansible/
     3 ├── nginx_roule.yml
     4 └── roles
     5     ├── httpd
     6     ├── memcache
     7     ├── mysql
     8     └── nginx
     9         ├── tasks
    10         │?? ├── group.yml
    11         │?? ├── main.yml
    12         │?? ├── restart.yml
    13         │?? ├── start.yml
    14         │?? ├── templ.yml
    15         │?? ├── user.yml
    16         │?? └── yum.yml
    17         └── templates
    18             └── nginx.conf.j2
    roles目录
    [root@linux-node1 ansible]# cat nginx_roule.yml 
    - hosts: date
      remote_user: root
      roles:
        - role: nginx
    
    [root@linux-node1 tasks]# cat main.yml 
    - include: group.yml
    - include: user.yml
    - include: yum.yml
    - include: templ.yml
    - include: start.yml
    
    [root@linux-node1 tasks]# cat group.yml 
    - name: create group
      group: name=nginx
    [root@linux-node1 tasks]# cat user.yml 
    - name: create user
      user: name=nginx group=nginx
    [root@linux-node1 tasks]# cat yum.yml 
    - name: install package
      yum: name=nginx
    [root@linux-node1 tasks]# cat templ.yml 
    - name: copy conf
      template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf
    [root@linux-node1 tasks]# cat start.yml 
    - name: start service
      service: name=nginx state=started enabled=yes
    [root@linux-node1 tasks]# cat restart.yml 
    - name: start service
      service: name=nginx state=restarted enabled=yes
    

  • 相关阅读:
    (Lineup the Dominoes筛子)三维状压
    Halloween Costumes 玄学题
    jQuery之动画
    javascript之位置
    javascript之事件
    jQuery之DOM
    jQuery之选择器
    jQuery简介
    javascript之Bom简介
    javascript之DOM操作
  • 原文地址:https://www.cnblogs.com/zhaojingyu/p/12133767.html
Copyright © 2011-2022 走看看