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 这里我们使用 ...
随机推荐
- [NOI2008]假面舞会——数论+dfs找环
原题戳这里 思路 分三种情况讨论: 1.有环 那显然是对于环长取个\(gcd\) 2.有类环 也就是这种情况 1→2→3→4→5→6→7,1→8→9→7 假设第一条链的长度为\(l_1\),第二条为\ ...
- 置换的玩笑——DFS&&暴力
题目 链接 题意:一个$1$到$n$的序列被去掉空格,需要将其还原.例如$4111109876532$可还原成$4 \ 1 \ 11 \ 10 \ 9 \ 8 \ 7 \ 6 \ 5 \ ...
- Codeforces Round #586 (Div. 1 + Div. 2) A. Cards
链接: https://codeforces.com/contest/1220/problem/A 题意: When Serezha was three years old, he was given ...
- oracle split函数
PL/SQL 中没有split函数,需要自己写. 代码: ); --创建一个 type ,如果为了使split函数具有通用性,请将其size 设大些. --创建function create or r ...
- 12 saltstack部署OpenStack
参考源码:https://github.com/unixhot/salt-openstack nova control.sls
- i3wm脚本
exec 执行命令 --no-startup-id 有些脚本或者程序不支持启动通知,不加命令,鼠标会长时间空转,60秒左右 exec_always 每次重启i3,使用该命令启动的程序都会重新执行一次, ...
- jquery实现ajax提交表单数据或json数据
- 怎么把word文档粘贴到编辑器里啊?
很多时候我们用一些管理系统的时候,发布新闻.公告等文字类信息时,希望能很快的将word里面的内容直接粘贴到富文本编辑器里面,然后发布出来.减少排版复杂的工作量. 下面是借用百度doc 来快速实现这个w ...
- Java中properties可以读取,但是里面的数据读取不到
今天配置一个项目jdbc.properties这个文件里面的键值总是读取不到,刚开始以为是文件没有读取到,但是测试是读取到的,再排查键值是不是写错了, 后来发现键值是对的,这就很奇怪了 比较是没有任何 ...
- tensorflow 框架图