ansible publishing service
# ansible 初始化服务机
- hosts: newserver
vars:
- basedir: opt
tasks:
- name: 安装常用依赖环境
yum: name={{ item }} state=present
with_items:
- lrzsz
- telnet
- wget
- epel-release - name: 为所有创建的新用户添加属组
group:
name: develop
state: present
- name: 将yutang用户加入develop组
shell: usermod -G develop yutang - name: 创建微服务基本运行父级目录环境
file: path=/{{ basedir }}/{{ item }}/ state=directory owner=test group=develop mode=0755
with_items:
- service
- server
- src - name: 创建微服务基本运行子级server目录环境
file: path=/{{ basedir }}/server/{{ item }}/ state=directory owner=test group=develop mode=0755
with_items:
- backup
- config - name: 创建微服务基本运行子级service目录环境
file: path=/{{ basedir }}/service/{{ item }}/ state=directory owner=yutang group=develop mode=0755
with_items:
- tmp
- logs - name: 下载jdk环境
get_url: url=http://mirror.cnop.net/jdk/linux/jdk-8u112-linux-x64.tar.gz dest=/{{ basedir }}/server/src mode=0655 force=yes owner=test
- name: 解压jdk压缩包
unarchive: src=/{{ basedir }}/server/src/jdk-8u112-linux-x64.tar.gz dest=/{{ basedir }}/server/ mode=0755 copy=no - name: 添加jdk环境变量
lineinfile: dest=/etc/profile line="export JAVA_HOME=/opt/server/jdk1.8.0_112" - name: 添加jdk环境变量
lineinfile: dest=/etc/profile line="export PATH=$JAVA_HOME/bin:$PATH" - name: 将本地logstash文件传输到远程服务器
copy: src=/{{ basedir }}/server/logstash.tar.gz dest=/{{ basedir }}/server/ owner=test group=develop mode=0755 - name: 解压logstash压缩包
unarchive: src=/{{ basedir }}/server/logstash.tar.gz dest=/{{ basedir }}/server/ mode=0755 owner=test group=develop copy=no - name: 将本地pinpoint文件传输到远程服务器
copy: src=/{{ basedir }}/server/pinpoint-agent.tar.gz dest=/{{ basedir }}/server/ owner=test group=develop mode=0755 - name: 解压pinpoint压缩包
unarchive: src=/{{ basedir }}/server/pinpoint-agent.tar.gz dest=/{{ basedir }}/service/ mode=0755 owner=test group=develop copy=no - name: 将本地consul文件传输到远程服务器
copy: src=/{{ basedir }}/server/consul.tar.gz dest=/{{ basedir }}/server/ owner=test group=develop mode=0755 - name: 解压consul压缩包
unarchive: src=/{{ basedir }}/server/consul.tar.gz dest=/{{ basedir }}/server/ mode=0755 owner=test group=develop copy=no - name: 移动config.tar.gz和ogstash.tar.gz到/alidata/server/download备份目录下
shell: /usr/bin/mv /{{ basedir }}/server/*.gz /{{ basedir }}/server/download/ - name: 授权所有目录权限为yutang
shell: chown -R test.develop /{{ basedir }} - name: 修改主机名
raw: "echo {{hostname|quote}} > /etc/hostname" - name: 设置主机名
shell: hostname {{hostname|quote}} - name: 刷新java环境变量
shell: source /etc/profile - name: 定时清理系统缓存
cron: name="每隔1小时清理一次系统缓存" job="/usr/bin/sync; /usr/bin/echo 3 > /proc/sys/vm/drop_caches" minute=*/60 state=present
ansible publishing service的更多相关文章
- Ansible笔记(7)---常用模块之系统类模块(cron、service)
一.cron模块 1.1作用: cron 模块可以帮助我们管理远程主机中的计划任务,功能相当于 crontab 命令. 在了解cron模块的参数之前,先写出一些计划任务的示例: # 示例1,每天的1点 ...
- 对ansible不支持service模块的status命令进行修正
原生的ansible不支持service.status,在Google之后,发现有人提交了一个patch,可以支持status选项.见https://github.com/ritzk/ansible- ...
- ansible的使用技巧
#查看ansible的帮助 $ ansible -h #ansible 指定不通的模块执行 $ ansible -i /etc/ansible/hosts docker -u root -m c ...
- ansible 安装使用
ansible ansible源码安装 yum -y install python-jinja2 PyPAML python-parmiko python-babel python-crypto ta ...
- 除非 Windows Activation Service (WAS)和万维网发布服务(W3SVC)均处于运行状态,否则无法启动网站。目前,这两项服务均处于停止状态。
win7 IIS 所有网站都停止了,启动提示: 除非 Windows Activation Service (WAS)和万维网发布服务(W3SVC)均处于运行状态,否则无法启动网站.目前,这两项服务均 ...
- IIS Default Web Site : The service did not response to the start or control request in a timely fashion
IIS Default Web Site无法启动,提示错误:The service did not response to the start or control request in a time ...
- Ansible 系列之 Ad-Hoc介绍及使用
Ad-Hoc 介绍 一.什么是ad-hoc 命令? ad-hoc 命令是一种可以快速输入的命令,而且不需要保存起来的命令.就相当于bash中的一句话shell.这也是一个好的地方,在学习ansible ...
- Windows 下 exe 服务注册到 service 服务中
window 下注册 exe 程序.添加到 服务中. window 注册服务方式 一. regsvr 方式 直接在 程序目录执行: Regsvr 32 命令是Windows中控件文件 ( 如扩展名为D ...
- ansible学习笔记二
Ad-Hoc命令: 所谓Ad-Hoc,简而言之是"临时命令",英文中作为形容词有"特别的,临时"的含义.Ad-Hoc只是官方对Ansible命令的一种称谓. 从 ...
随机推荐
- Ural 1114 Boxes
Boxes Time Limit: 600ms Memory Limit: 16384KB This problem will be judged on Ural. Original ID: 1114 ...
- POJ 2115 简单的模线性方程求解
简单的扩展欧几里得题 这里 2^k 不能自作聪明的用 1<<k来写 , k >= 31时就爆int了 , 即使定义为long long 也不能直接这样写 后来老老实实 for(int ...
- hdu4288 Coder(线段树单点更新)
题意:支持增删,查操作,最后的序列式递增的. 做法:主要是如何维护mod5的sum值,这里左儿子可以不用管,关键是右儿子的处理,可以假设右儿子有t个节点,左儿子有cnt个节点, 则令(t+cnt)MO ...
- 转载 - PowerDesigner(CDM—PDM—SQL脚本的转换流程)
出处: http://jbeduhai.iteye.com/blog/338579 由于图片复制上去不显示,如想看内容及图片详情,请下载附件 PowerDesigner数据模型(CDM—PDM—SQL ...
- android调试
要进行调试,首先构建app的时候必须选择是Debug模式,而不能是Release模式. 接下来的内容转载自: http://www.cnblogs.com/gaoteng/p/5711314.html ...
- ACM 数学
欧几里得辗转相除法求最大公约数 int gcd(int a,int b) { ) return a; else return gcd(b,a%b); } 求组合数 int C(int n ,int m ...
- $scope的生命周期
model mutation 模型改变 model observation 模型观察 scope destruction scope结束 神奇的scope,一个angular应用只有一个scope,一 ...
- c++中的set_new_handler和new_handler
当operator new申请一个内存失败的时候,它会进行如下的处理步骤: 1.如果存在客户指定的处理函数,则调用处理函数(new_handler),如果不存在则抛出一个异常. 2.继续申请内存 ...
- Python3基础(五) 函数
函数(function)是组织好的.可重复使用的.具有一定功能的代码段.函数能提高应用的模块性和代码的重复利用率,Python中已经提供了很多内建函数,比如print(),同时Python还允许用户自 ...
- LeetCode 206. Reverse Linked List (倒转链表)
Reverse a singly linked list. 题目标签:Linked List 题目给了我们一个链表,要求我们倒转链表. 利用递归,新设一个newHead = null,每一轮 把下一个 ...