diff --git a/ansible-role.md b/ansible-role.md
index 5caf471..d048848 100644
--- a/ansible-role.md
+++ b/ansible-role.md
@@ -1,138 +1,138 @@
-
Ansible-role
-
-------
-
-## 一:介绍
-
- Roles是在ansible中,playbook的目录组织结构。每一个角色是由名字的,他是一个目录,可以包含子目录。
-
- 以特定的层次目录结构进行组织的tasks、variables、handlers、templates、files等。
-
-## 二:目录作用
-
-- role_name:这个是角色的名称
-- files:存储有copy或script等模块调用的文件
-- tasks:专门存储任务的目录,一个角色可以定义多个任务;此目录中至少应该有一个名为main.yml的文件,用于定义各task;其他的文件需要由main.yml进行“包含”调用
-- handlers:条件前一个任务执行成功去执行下面的,处理特定事物的文件,此目录中至少应该有一个名为main.yml的文件,用于定义各handlers;其它的文件需要由main.yml进行“包含”调用
-- vars:变量,定义变量的文件;此目录中至少应该有一个名为main.yml的文件,用于定义各variable;其它的文件需要由main.yml进行“包含”调用
-- templates:模板 使用变量的文件存储由template模块调用的模板文本
-- meta:此目录中至少应该有一个名为main.yml的文件,定义当前角色的特殊设定及其依赖关系;其它的文件需要由main.yml进行“包含”调用
-- default:此目录中至少应该有一个名为main.yml的文件,用于设定默认变量
-
-## 三:目录案例
-
- nginx是一个角色的名字,角色里用到文件放在files中,通过创建playbook来调用这些角色
-
-
-
-## 四:项目案例
-
-准备目录结构:
-
-```bash
-[root@ansible-server ~]# cd /etc/ansible/roles/
-[root@ansible-server roles]# mkdir nginx/{files,handlers,tasks,templates,vars} -p
-```
-
-创建文件:
-
-```bash
-[root@ansible-server roles]# touch site.yml nginx/{handlers,tasks,vars}/main.yml
-[root@ansible-server roles]# yum -y install tree
-[root@ansible-server roles]# tree nginx/
-nginx/
-├── files
-├── handlers
-│ └── main.yml
-├── tasks
-│ └── main.yml
-├── templates
-└── vars
- └── main.yml
-
-5 directories, 3 files
-```
-
-创建nginx的测试文件:
-
-```bash
-[root@ansible-server roles]# echo 1234 > nginx/files/index.html
-```
-
-安装nignx并配置模板:
-
-```bash
-[root@ansible-server roles]# yum -y install nginx
-[root@ansible-server roles]# cp /etc/nginx/nginx.conf nginx/templates/nginx.conf.j2
-```
-
-编写任务:
-
-```bash
-[root@ansible-server roles]# vim nginx/tasks/main.yml
- 1 ---
- 2 - name: install epel
- 3 yum: name=epel-release state=latest
- 4 - name: install nginx
- 5 yum: name=nginx state=latest
- 6 - name: copy nginx.conf template
- 7 template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf
- 8 - name: copy index.html
- 9 copy: src=index.html dest=/usr/share/nginx/html/index.html
- 10 notify: start nginx
-```
-
-template模块:
-
-```bash
-[root@ansible-server roles]# vim nginx/templates/nginx.conf.j2
-```
-
-自定义变量:
-
-
-
-编写变量:
-
-```bash
-[root@ansible-server roles]# vim nginx/vars/main.yml
- 1 worker_connections: 2
-```
-
-编写handlers:
-
-```bash
-[root@ansible-server roles]# vim nginx/handlers/main.yml
- 1 ---
- 2 - name: start nginx
- 3 service: name=nginx state=started
-```
-
-编写剧本:
-
-```bash
-[root@ansible-server roles]# vim site.yml
- 1 ---
- 2 - hosts: ansible-web1
- 3 user: root
- 4 roles:
- 5 - nginx
-```
-
-检测语法:
-
-```bash
-[root@ansible-server roles]# ansible-playbook --syntax-check site.yml
-
-playbook: site.yml
-```
-
-运行剧本:
-
-```bash
-[root@ansible-server roles]# ansible-playbook site.yml
-```
-
-注意:
-
+ Ansible-role
+
+------
+
+## 一:介绍
+
+ Roles是在ansible中,playbook的目录组织结构。每一个角色是由名字的,他是一个目录,可以包含子目录。
+
+ 以特定的层次目录结构进行组织的tasks、variables、handlers、templates、files等。
+
+## 二:目录作用
+
+- role_name:这个是角色的名称
+- files:存储有copy或script等模块调用的文件
+- tasks:专门存储任务的目录,一个角色可以定义多个任务;此目录中至少应该有一个名为main.yml的文件,用于定义各task;其他的文件需要由main.yml进行“包含”调用
+- handlers:条件前一个任务执行成功去执行下面的,处理特定事物的文件,此目录中至少应该有一个名为main.yml的文件,用于定义各handlers;其它的文件需要由main.yml进行“包含”调用
+- vars:变量,定义变量的文件;此目录中至少应该有一个名为main.yml的文件,用于定义各variable;其它的文件需要由main.yml进行“包含”调用
+- templates:模板 使用变量的文件存储由template模块调用的模板文本
+- meta:此目录中至少应该有一个名为main.yml的文件,定义当前角色的特殊设定及其依赖关系;其它的文件需要由main.yml进行“包含”调用
+- default:此目录中至少应该有一个名为main.yml的文件,用于设定默认变量
+
+## 三:目录案例
+
+ nginx是一个角色的名字,角色里用到文件放在files中,通过创建playbook来调用这些角色
+
+
+
+## 四:项目案例
+
+准备目录结构:
+
+```bash
+[root@ansible-server ~]# cd /etc/ansible/roles/
+[root@ansible-server roles]# mkdir nginx/{files,handlers,tasks,templates,vars} -p
+```
+
+创建文件:
+
+```bash
+[root@ansible-server roles]# touch site.yml nginx/{handlers,tasks,vars}/main.yml
+[root@ansible-server roles]# yum -y install tree
+[root@ansible-server roles]# tree nginx/
+nginx/
+├── files
+├── handlers
+│ └── main.yml
+├── tasks
+│ └── main.yml
+├── templates
+└── vars
+ └── main.yml
+
+5 directories, 3 files
+```
+
+创建nginx的测试文件:
+
+```bash
+[root@ansible-server roles]# echo 1234 > nginx/files/index.html
+```
+
+安装nignx并配置模板:
+
+```bash
+[root@ansible-server roles]# yum -y install nginx
+[root@ansible-server roles]# cp /etc/nginx/nginx.conf nginx/templates/nginx.conf.j2
+```
+
+编写任务:
+
+```bash
+[root@ansible-server roles]# vim nginx/tasks/main.yml
+ 1 ---
+ 2 - name: install epel
+ 3 yum: name=epel-release state=latest
+ 4 - name: install nginx
+ 5 yum: name=nginx state=latest
+ 6 - name: copy nginx.conf template
+ 7 template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf
+ 8 - name: copy index.html
+ 9 copy: src=index.html dest=/usr/share/nginx/html/index.html
+ 10 notify: start nginx
+```
+
+template模块:
+
+```bash
+[root@ansible-server roles]# vim nginx/templates/nginx.conf.j2
+```
+
+自定义变量:
+
+
+
+编写变量:
+
+```bash
+[root@ansible-server roles]# vim nginx/vars/main.yml
+ 1 worker_connections: 2
+```
+
+编写handlers:
+
+```bash
+[root@ansible-server roles]# vim nginx/handlers/main.yml
+ 1 ---
+ 2 - name: start nginx
+ 3 service: name=nginx state=started
+```
+
+编写剧本:
+
+```bash
+[root@ansible-server roles]# vim site.yml
+ 1 ---
+ 2 - hosts: ansible-web1
+ 3 user: root
+ 4 roles:
+ 5 - nginx
+```
+
+检测语法:
+
+```bash
+[root@ansible-server roles]# ansible-playbook --syntax-check site.yml
+
+playbook: site.yml
+```
+
+运行剧本:
+
+```bash
+[root@ansible-server roles]# ansible-playbook site.yml
+```
+
+注意:
+
ansible会使用jinja2模块来修改被管理主机的配置文件;使用ansible的jinja2模块,也就是template模块,该模块和copy模块一样,都是将文件复制到远端主机上;区别在于template模块可以获取要复制的文件中变量的值;而copy则是原封不动的把文件内容复制过去,比如针对不同的主机定义不同的变量,template会在将配置文件分发出去之前读取变量到jinja2模板,然后分发到不同的被管理的主机上;ansible允许jinja2模板中使用条件判断和循环,但是jinja2判断循环语法不允许在playbook中使用;jinja2文件以.j2为后缀,也可以不写后缀。
\ No newline at end of file