上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 25 下一页
摘要: 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 随心朝阳 阅读(221) 评论(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 随心朝阳 阅读(725) 评论(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 随心朝阳 阅读(843) 评论(0) 推荐(0) 编辑
摘要: 一、playbook变量变量名:字母数字和下划线 二、变量来源 1.ansible 主机 -m setup|less所有主机都可以调用 #过滤-a 'filter=*address*' 1.1例子创建一个hostname 的log文件 ansible date -m setup -a 'filter 阅读全文
posted @ 2019-12-29 18:31 随心朝阳 阅读(304) 评论(0) 推荐(0) 编辑
摘要: 一、tags标签 [root@linux-node1 ansible]# cat httpd.yaml - hosts: date remote_user: root tasks: - name: install httpd package yum: name=httpd tags: inshttp 阅读全文
posted @ 2019-12-29 18:01 随心朝阳 阅读(1388) 评论(0) 推荐(0) 编辑
摘要: 一 、handlers和notify结合触发条件 handlers(触发器): 定义一些task列表,与之前剧本中task没有关系,只有资源发送变化才会采取一定的操作 notify:notify中调用handler中定义的操作 二、修改配置文件,重启服务 1、yum安装httpd [root@lin 阅读全文
posted @ 2019-12-29 17:46 随心朝阳 阅读(3738) 评论(0) 推荐(0) 编辑
摘要: 一、playbook基本格式如下 [root@linux-node1 ansible]# cat file.yaml # 主机 - hosts: date # 用户 remote_user: root # 任务 tasks: - name: create new_file file: name=/d 阅读全文
posted @ 2019-12-29 17:07 随心朝阳 阅读(296) 评论(0) 推荐(0) 编辑
摘要: 一、ansible优化 vim /etc/ansible/ansible.cfg host_key_checking = False #不进行验证 log_path = /var/log/ansible.log #打开日志 基于ssh vim /etc/ssh/sshd_config UseDNS 阅读全文
posted @ 2019-12-29 13:25 随心朝阳 阅读(259) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 25 下一页