playbook部署flanneld
定义playbook的主机组 说明: 1、playbook的主机组和ansible的主机组不一样, 2、playbook的主机组文件必须要和playbook文件在同一个目录下否则会报如下错误: [root@test1 profile]# ansible-playbook -i hosts deploy_flanneld.yaml --list-hosts
[WARNING]: Unable to parse /k8s/profile/hosts as an inventory source 3、执行playbook必须要在plyaybook文件所在目录下执行,否则报错;跟带不带绝对路径没有关系,必须保证在同一个目录 4、执行playbook的任何相关操作都要在plyaybook文件所在目录下执行,否则报错;跟带不带绝对路径没有关系,必须保证在同一个目录 cat >/k8s/profile/hosts <<EOF
[webservers]
192.168.0.91
192.168.0.92
EOF playbook文件 cat > /k8s/profile/deploy_nginx.yaml <<EOF
---
- hosts: webservers
become: yes
become_method: sudo
vars:
worker_processes: 4
worker_connections: 768
max_open_files: 65506
tasks:
- name: install nginx
command: yum install nginx -y - name: copy nginx config file
template: src=/home/lmx/test_ansible/nginx.conf.j2 dest=/etc/nginx/nginx.conf
notify: restart nginx - name: copy index.html
template:
src: /home/lmx/test_ansible/index.html.j2
dest: /usr/share/nginx/www/index.html
mode: 0644
notify: restart nginx - name: see file
command: ls /root
notify: restart nginx handlers:
- name: restart nginx
service: name=nginx state=restarted
EOF 模板文件 mkdir -p /home/lmx/test_ansible/ cat > /home/lmx/test_ansible/nginx.conf.j2 << EOF
worker_processes {{ worker_processes }};
worker_rlimit_nofile {{ max_open_files }}; events {
worker_connections {{ worker_connections }};
} http {
server {
listen 80;
root /usr/share/nginx/www;
index index.html index.htm default.html index.php;
server_name loclhost;
location / {
try_files $uri $uri/ =404;
}
} }
EOF cat > /home/lmx/test_ansible/index.html.j2 <<EOF
<html>
<head>
<title>welcome to american</title>
</head>
<body>
<h1>nginx, confitured by ansible</h1>
<p>if you can see this, ansible successfully installed nginx.</p> <p>{{ ansible_hostname }}</p>
</body>
</html>
EOF 开始部署: 说明:必须切换到playbook所在文件目录下执行,否则报错 [root@test1 ~]# cd /k8s/profile/
[root@test1 profile]# ansible-playbook deploy_flanneld.yaml
playbook部署flanneld的更多相关文章
- playbook部署coredns
playbook部署coredns 说明test1是主控节点,目的是给test4 node节点安装coredns, 1.coredns-1.2.2.tar.gz安装包放到主控节点/server/sof ...
- 通过PlayBook部署Zabbix
编写Linux初始化剧本 初始化剧本环节,主要用户实现关闭Selinux关闭防火墙,一起配置一下阿里云的YUM源地址,和安装EPEL源,为后期的zabbix安装做好铺垫工作. 1.在安装Zabbix之 ...
- 通过Playbook部署LAMP
Ansible的PlayBook文件格式为YAML语言,所以希望你在编写PlayBook前对YAML语法有一定的了解,否则在运行PlayBook的时候经常碰到语法错误提示,这里我们通过介绍批量部署LA ...
- playbook部署nginx
定义playbook的主机组 说明: 1.playbook的主机组和ansible的主机组不一样, 2.playbook的主机组文件必须要和playbook文件在同一个目录下否则会报如下错误: [ro ...
- ansible playbook部署ELK集群系统
一.介绍 总共4台机器,分别为 192.168.1.99 192.168.1.100 192.168.1.210 192.168.1.211 服务所在机器为: redis:192.168.1.211 ...
- playbook部署mangodb
playbook文件 [root@localhost ~]# cat deploy_mongo.yaml --- - hosts: webservers become: yes become_meth ...
- Ansible playbook 部署filebeat
- hosts: all tasks: - name: Copy Package copy: src=/usr/local/filebeat--linux-x86_64.tar.gz dest=/us ...
- Ansible playbook 部署Openresty
- hosts: all tasks: - name: copy package copy: src=/usr/local/openresty-1.13.6.1.tar.gz dest=/usr/lo ...
- 07-部署Flanneld网络
部署Flanneld网络 Flanneld:用于解决容器之间网络互通,这里我们要配置TLS认证. Docker1.12.5:docker的安装很简单,这里也不说了. 配置Flanneld 这里我们使用 ...
随机推荐
- Go语言值,指针,引用类型
原文:https://www.jianshu.com/p/af42cb368cef ---------------------------------------------------- Go语言的 ...
- 利用Struts上传文件
在利用struts2完成上传文件到服务器时,遇到获取不到文件名 原因是在Action中的属性名没有和jsp中的属性名匹配 <%@ page language="java" i ...
- DTcmsV4.0分析学习——(3)URL重写
3.URL重写 3.1 控制流程 通过IHttpModule控制所有页面请求,具体流程如下 (1)真实路径可正常访问 (2)前台页面通过URL重写映射aspx目录,后台页面通过URL重写映射admin ...
- CSS效果篇--纯CSS+HTML实现checkbox的思路与实例
checkbox应该是一个比较常用的html功能了,不过浏览器自带的checkbox往往样式不怎么好看,而且不同浏览器效果也不一样.出于美化和统一视觉效果的需求,checkbox的自定义就被提出来了. ...
- springboot项目下载文件功能中-切面-导致的下载文件失败的bug
背景:使用spring提供的 ResponseEntity 和Resource结合,实现的下载文件功能 bug:Resource已经加载到了文件, 并且通过 ResponseEntity 构建了响应, ...
- unity 用代码控制动画的播放的进度
https://answers.unity.com/questions/1225328/imported-animated-object-and-slider-tutorial.html using ...
- SpringBoot 测试类 @RunWith & @SpringBootTest
@RunWith(SpringRunner.class) @SpringBootTest public class RabbitMqTest { @Autowired RabbitMqSender r ...
- Mybatis源码学习之parsing包(解析器)(二)
简述 大家都知道mybatis中,无论是配置文件mybatis-config.xml,还是SQL语句,都是写在XML文件中的,那么mybatis是如何解析这些XML文件呢?这就是本文将要学习的就是,m ...
- JavaWeb_(Hibernate框架)Hibernate中数据查询语句Criteria基本用法
Criteria进行数据查询与HQL和SQL的区别是Criteria完全是面向对象的方式在进行数据查询,将不再看到有sql语句的痕迹,使用Criteria 查询数据包括以下步骤: 1. 通过sessi ...
- load加载层
//eg1 var index = layer.load(); //eg2 var index = layer.load(1); //换了种风格 //eg3 var index = layer.loa ...