摘要: 1、模拟安装httpd 1 [root@linux-node1 ansible]# tree roles/ 2 roles/ 3 ├── app 4 │ ├── files 5 │ │ └── vhosts.conf 6 │ ├── handlers 7 │ │ └── main.yml 8 │ ├ 阅读全文
posted @ 2020-01-02 19:58 随心朝阳 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 1、在模拟一个http的role 1 [root@linux-node1 ansible]# cat httpd_role.yml 2 - hosts: date 3 remote_user: root 4 5 roles: 6 - httpd 7 [root@linux-node1 tasks]# 阅读全文
posted @ 2020-01-02 18:33 随心朝阳 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-01-02 16:35 随心朝阳 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 1、for循环简单应用 [root@linux-node1 ansible]# cat testfor.yaml - hosts: date remote_user: root vars: ports: - 81 - 82 - 83 tasks: - name: copy conf template 阅读全文
posted @ 2020-01-02 15:37 随心朝阳 阅读(721) 评论(0) 推荐(0) 编辑
摘要: 1、基本使用 [root@linux-node1 ansible]# cat testitem.yaml - hosts: date remote_user: root tasks: - name: create some files file: name=/data1/{{ item }} sta 阅读全文
posted @ 2020-01-02 15:02 随心朝阳 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 1、模拟6和7系统(6对应11、7对应12) [root@linux-node1 ansible]# cat test_template2.yaml - hosts: date remote_user: root vars: - http_port: 99 tasks: - name: instal 阅读全文
posted @ 2020-01-02 11:43 随心朝阳 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 一、在剧本的当前目录创建templates文件夹(template只能在剧本使用) 二、例子 2.1 [root@linux-node1 ansible]# cat test_template.yaml - hosts: date remote_user: root tasks: - name: i 阅读全文
posted @ 2020-01-02 11:01 随心朝阳 阅读(839) 评论(0) 推荐(0) 编辑