Jenkins+Ansible+Gitlab自动化部署三剑客
一、gitlab安装
环境:centos 7 x64
1、关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
2、禁用selinux
vim /etc/selinux/config # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted 改为SELINUX=disabled,然后重启服务器,使用getenforce进行验证
3、安装环境依赖
yum install curl policycoreutils openssh-server openssh-clients postfix
4、下载仓库文件
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
5、启动邮件服务
systemctl start postfix
systemctl enable postfix
6、安装gitlab-ce
yum install -y gitlab-ce
7、配置ssl
mkdir /etc/gitlab/ssl
cd /etc/gitlab/ssl
openssl genrsa -out /etc/gitlab/ssl/gitlab.example.com.key
openssl req -new -key "gitlab.example.com.key" -out "gitlab.example.com.csr"
openssl x509 -req -days -in "gitlab.example.com.csr" -signkey "gitlab.example.com.key" -out "gitlab.example.com.crt"
openssl dhparam -out dhparams.pem
chmod *
8、配置gitlab.rb
vim /etc/gitlab/gitlab.rb external_url 'https://gitlab.example.com'
//external_url 'https://192.168.71.128'
nginx['redirect_http_to_https'] = true nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.example.com.crt" nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.example.com.key" nginx['ssl_dhparam'] = "/etc/gitlab/ssl/dhparams.pem" # Path to dhparams.pem, eg. /etc/gitlab/ssl/dhparams.pem gitlab-ctl reconfigure
9、配置nginx
server {
listen *:;
server_name gitlab.example.com;
//server_name 192.168.71.128;
rewrite ^(.*)$ https://$host$1 permanent;
server_tokens off; ## Don't show the nginx version number, a security best practice
10、运维工程师使用
a、新建项目

b、用户维护,创建regular用户

c、给项目分配用户及权限,分配dev用户和maintainer用户


11、开发组长使用
//克隆仓库
git -c http.sslverify=false clone https://192.168.71.128/root/test-repo.git
处理合并申请
12、开发人员使用
git -c http.sslverify=false clone https://192.168.71.128/root/test-repo.git
创建分支合并申请

二、ansible安装
1、环境准备(python3.6.5安装及virtualenvwrapper管理虚拟环境)
详见:https://www.cnblogs.com/hougang/p/11423083.html
2、pip安装
mkvirtualenv -p python3 env36
pip install ansible
3、git安装
root用户安装git
yum -y install git nss curl 切换到普通用户
su deploy
cd ~ git clone ansible(可以将github源导入码云,然后再clone码云上的ansible,不然下载会很慢或失败)
git clone https://github.com/ansible/ansible.git 进入env36环境
workon env36 安装ansible依赖包
pip install paramiko PyYAML jinja2 将ansible移动到虚环境目录下
mv ansible ~/.virtualenvs/env36.ansible/
cd ~/.virtualenvs/env36.ansible/ansible 切换分支
git checkout stable-2.5 安装
source ~/.virtualenvs/env36.ansible/ansible/hacking/env-setup -q 验证
ansible --version
3、ansible使用
ansible主机:192.168.71.132
ssh-keygen -t rsa
ssh-copy-id -i id_rsa.pub root@192.168.71.133
测试机:192.168.71.133
Jenkins+Ansible+Gitlab自动化部署三剑客的更多相关文章
- Jenkins+Ansible+Gitlab自动化部署三剑客-Ansible本地搭建
可以通过git bash连接linux 关闭防火墙,禁用防火墙开机启动,并更爱selinux文件,重启 重新登录并检查禁用 getenforce 安装git yum -y install git ns ...
- Jenkins+Ansible+Gitlab自动化部署三剑客-gitlab本地搭建
实际操作 准备linux初始环境 关闭防火墙 systemctl stop firewalld 开机自己关闭 systemctl disable firewalld 设置安全配置 为关闭 vim /e ...
- Jenkins+Ansible+Gitlab自动化部署三剑客-Jenkins本地搭建
后面需要shell基础,目前没有,等有了,再更
- Jenkins Ansible GitLab 自动化部署
Jenkins Ansible GitLab 自动化部署 DevOps https://www.cnblogs.com/yangjianbo/articles/10393765.html https: ...
- Jenkins+maven+gitlab自动化部署之基础环境部署(一)
从一个二线城市,来到上海,刚入职,老大就给任务,为了减少开发打包部署时间,需要搭建一套自动化部署环境.接到任务后,赶紧上网查找资料,以及了解jenkins作用等等,用了一周时间,了解了个大概,由于都是 ...
- Jenkins+maven+gitlab自动化部署之docker发布sprint boot项目(七)
Jenkins发布docker应用与发布java应用配置基本一致,需要配置Dockerfile及构建的步骤,步骤如下: 1.jenkins主机构建应用为jar包 2.jenkins主机把生产的jar包 ...
- Jenkins+maven+gitlab自动化部署之前端构建发布(六)
前端项目构建,需要在jenkins主机部署node服务,网上有说介绍说安装对应的nodejs插件进行前端项目构建,我这里是直接调用系统npm命令,进行前端打包.具体node部署参考:Centos7部署 ...
- Jenkins+maven+gitlab自动化部署之构建Java应用(五)
前面几篇文章介绍jenkins部署以及配置,接下来我们,就介绍下如何使用jenkins发布应用. 1)新建项目 jenkins首页,点击左上新建任务,出现下图,填写对应信息,然后点击确定: 2)项目参 ...
- Jenkins+maven+gitlab自动化部署之Jenkins部署(三)
本章开始正式搭建Jenkins: 公司现在使用的jenkins版本是2.150.3,但是本次实验安装的版本我们选择最新的 2.164.3(当然,当你阅读这篇文章时,此版本已经不是最新),jenkins ...
随机推荐
- JavaScript教程——数据类型概述
简介 JavaScript 语言的每一个值,都属于某一种数据类型.JavaScript 的数据类型,共有六种.(ES6 又新增了第七种 Symbol 类型的值,本教程不涉及.) 数值(number): ...
- 数据结构系列文章之队列 FIFO
转载自https://mp.weixin.qq.com/s/ILgdI7JUBsiATFICyyDQ9w Osprey 鱼鹰谈单片机 3月2日 预计阅读时间: 6 分钟 这里的 FIFO 是先入先出 ...
- oracle之函数-数字,日期,转换,字符串,其他
-----------------------------oracle数据库函数----------------------------------------数学函数***select abs(-1 ...
- POI做题笔记
POI2011 Conspiracy (2-SAT) Description \(n\leq 5000\) Solution 发现可拆点然后使用2-SAT做,由于特殊的关系,可以证明每次只能交换两个集 ...
- 调用jquery.Jcrop.min.js 切割图片 实例
需求是:上传一个图片,然后将上传的这个图片进行切割........ 首先是jsp页面.页面需要引入js <script src="${fileUrlPrx}/scripts/wap/ ...
- 10 masterless、高可用、salt执行模块开发、sydic架构
1.salt无master 官方文档: http://docs.saltstack.cn/topics/tutorials/quickstart.html 1.使用场景 1.在项目中使用salt,写一 ...
- 记录 vant Picker 选择器,实现三级联动,传对应省市区code值
最近使用vant UI写移动端,感觉还不错 功能挺全的,带的还有省市区三级联动. 但是 突然遇到一个 产品要传的 省市区的code码,还和vant的 邮编不一样,我*****. 看了一下vant UI ...
- nginx之location部署yii项目(不使用nginx端口转发)
前言: 之前部署yii项目的时候, 使用的是域名, 后来使用nginx进行端口转发(反向代理)来部署yii项目. 这一次部署尝试只使用location 进行部署(不需要使用端口). 先贴出nginx的 ...
- HGOI 20191105 题解
Problem A Joker 老虎和蒜头是好朋友. 夏天过去了,凉爽的秋天来临,老虎和蒜头又有了新的娱乐项目.老虎有一个远房表亲是西伯利亚虎,那里流行着一个纸牌游戏:两位玩家参与游戏,道具是一副54 ...
- jQuery系列(六):jQuery的文档操作
1.插入操作 (1) 语法: 父元素.append(子元素) 解释:追加某元素,在父元素中添加新的子元素.子元素可以为:stirng | element(js对象) | jquery元素 let ol ...