当前位置:网站首页>Jenkins继续集成2
Jenkins继续集成2
2022-06-28 05:33:00 【藕粉姜】
节点管理
删除之前的节点
默认状态

这个表示master除了做持续集成和持续交付外,本身也要做构建,如果在上面创建的项目越来越多的时候,如果只在一台机器上建,会负载不了,一般情况下,都会把构建任务从master分离出来
重建创建vm5
主机
cd /var/lib/libvirt/images/
rm -f vm5
qemu-img create -f qcow2 -b small-new.qcow2 vm5
server5
yum install -y java-1.8.0-openjdk.x86_64
在jenkins新建节点,专门做构建的



如果不让master不工作的话,只需要将数量改为0就可以了
问题:如果gitlab的密码不知道了
cd /etc/gitlab
gitlab-ctl uninstall
gitlab-ctl cleanse
//rm -f initial_root_password
//gitlab-ctl reconfigure

find / -name *gitlab*
再重新部署gitlab
server4
cd /etc/yum.repos.d/
ls
scp docker.repo server5:/etc/yum.repos.d/
cd /etc/sysctl.d/
ls
scp docker.conf server5:/etc/sysctl.d/
cd /etc/docker/
scp -r certs.d/ daemon.json server5:/etc/docker/
server5
yum install -y docker-ce
sysctl --system
systemctl enable --now docker
vim /etc/hosts
172.25.0.1 server1 reg.westos.org
systemctl restart docker
docker info
docker pull nginx

新建用户
控制用户权限

新建的用户就没有权限了。







gitlab密码重新获得之后,新建项目
server2
git push -u origin main
之后刷新
问题:如果jenkins出现以下情况
是因为server3的公钥没有复制
server3
cd .ssh/
cat id_rsa.pub #将其中的内容复制到gitlab SSH中
先把docker_project_test 先禁用
如果test的控制台输出也出错了
可能是因为server5上没有安装git。
yum install -y git






把很多自由风格的项目串成流水线







构建主机时固定的,可以以下操作
server5
cd /tmp/workspace/
cd devops
ls
ssh-keygen
ssh-copy-id server4
如果构建主机不是固定的,
ssh-agent 帮你在这个里直接缓存你的凭据。
构建凭据

自动触发

高级

保存
jenkins结合钉钉报警
安装插件
创建一个报警群
在智能群助手中創建一個机器人,关键字jenkins,复制webhook地址,




测试上传失败

通过gitlab做版本控制
创建个项目

server2
vim Jenkinsfile #将之前的代码写到里面
git addJenkinsfile
git commit -m "add Jenkinsfile"
git push -u origin main
做修改



在master的设置中
集合ansible
在jenkins这台主机上安装ansible
rpm -ivh ansible-2.8.5-1.el7.noarch.rpm
yum install -y ansible-2.8.5-1.el7.noarch.rpm
有本地源则创建一个ansible源
cd /etc/yum.repos.d/
vim ansible.repo
yum install ansible

把四个包访问一个目录里,yum install *
ansible -v
cd /etc/ansible/
ls
cat ansible.cfg #主配置文件
cat hosts #对象
gitee
server2
git clone [email protected]:root/ansible.git
cd ansible/
ls
server4,5
systemctl stop docker
systemctl stop docker.socket
netstat -antlp
推ansible的play-book在server4,5
server4作为测试环境,5作为生产环境
jenkins会通过git方式从仓库中拉取下来,所有的信息都是放在仓库中,做任何变更都有版本控制的。
server2
vim ansible.cfg



mkdir inventory
cd inventory/
ls
vim test
[test]
172.25.0.4
vim prod
[prod]
172.25.0.5
cd ..
vim playbook.yml
---
- hosts:all
tasks:
- name: install httpd
yum:
name: httpd
state:present
- name: create index.html #创建模板
template:
src: index.html.j2
dest: /var/www/html/index.html
- name: start httpd
service:
name:httpd
state:started
enabled:yes
vim index.html.j2
{
{ ansible_hostname }}
ls
git add .
git status -s
git commit -m "add playbook.yaml"
git push -u origin main

在jenkins拉取,新建项目





server3
cd /var/lib/jenkins/
cd workspace/
ls
如果是构建主机,比如是server5,构建的是/tmp/,那就在/tmp/下面
在ansible的主配置文件中,连接远程是要通过ssh
ssh [email protected] 这个用户是在远程主机上创建的,然后通过sudo来运行,如果不做这个设置的话,会通过jenkins用户去访问,但这个是错的
server4,5
useradd devops
visudo

server4
passwd devops
设置用户密码
server5
echo westos | passwd --stdin devops
server3
su - jenkins
cat /etc/passwd
usermod -s /bin/bash jenkins
su - jenkins
ssh-keygen
ssh-copy-id [email protected]
ssh-copy-id [email protected]
ssh [email protected] #测试
ssh [email protected]
ssh [email protected]
ssh [email protected]
然后退出来就行
ansible- playbook -i inventory/test playbook.yml

边栏推荐
- Detailed usage configuration of the shutter textbutton, overview of the shutter buttonstyle style and Practice
- RL 实践(0)—— 及第平台辛丑年冬赛季【Rule-based policy】
- Programmer - Shepherd
- Docker installs mysql5.7 and starts binlog
- 如何做好水库大坝安全监测工作
- Shanghai Yuge ASR CAT1 4G module 2-way low power 4G application
- [Linux] - using xshell to install MySQL on Linux and realize the deployment of webapp
- How to learn programmable logic controller (PLC)?
- The heading angle of sliceplane is the same as that of math Corresponding transformation relation of atan2 (y, x)
- 【C语言练习——打印空心正方形及其变形】
猜你喜欢

mysql导出数据库字典成excel文件

JSP
![[untitled] drv8825 stepping motor drive board schematic diagram](/img/30/02f695592f3b624ebbb2b7a9f68052.png)
[untitled] drv8825 stepping motor drive board schematic diagram

Oracle 条件、循环语句

Share a powerful tool for factor Mining: genetic programming

Function reentry caused by Keil C51's data overlaying mechanism

Shanghai Yuge ASR CAT1 4G module 2-way low power 4G application

【LeetCode】12、整数转罗马数字

How does the power outlet transmit electricity? Simple problems that have plagued my little friend for so many years

Store inventory management system source code
随机推荐
Yin Yang master page
Online yaml to JSON tool
拉萨手风琴
【C语言练习——打印空心正方形及其变形】
Prove that there are infinite primes / primes
数据仓库:金融/银行业主题层划分方案
5GgNB和ng-eNB的主要功能
SlicePlane的Heading角度与Math.atan2(y,x)的对应转换关系
qtcanpool 知 07:Ribbon
CpG solid support research: lumiprobe general CpG type II
1404. number of steps to reduce binary representation to 1
数据中台:数据治理的七把利剑
msa.h:没有那个文件或目录
Intensive learning notes
【Linux】——使用xshell在Linux上安装MySQL及实现Webapp的部署
When excel copies the contents of a row, the columns are separated by the tab "\t"
Blog login box
8VC Venture Cup 2017 - Elimination Round D. PolandBall and Polygon
一看就会 MotionLayout使用的几种方式
Video tutorial on website operation to achieve SEO operation [21 lectures]