Jenkins + Ansible + Gitlab automate the deployment Three Musketeers (eight) - Jenkins ansible Integration

Jenkins Ansible integration

Ready to work

Reference https://www.cnblogs.com/bk770466199/p/12259007.html performed the following

Jenkins required on the server, configure the virtual environment ansible2.5 + python 3.6

Host Configuration jenkins.example.com to test.example.com ssh host keys-free certification

Configuring ansible, create a file testservers

1. Create a new project

 

 2. Add the shell

 

 

#!/bin/sh

set +x
source /home/deploy/.py3-a2.5-env/bin/activate
source /home/deploy/.py3-a2.5-env/ansible/hacking/env-setup -q

cd /home/deploy
ansible --version
ansible-playbook --version

cat testservers

ansible -i testservers testserver -m command -a "ip addr"
set -x

3.查看日志

 

Guess you like

Origin www.cnblogs.com/bk770466199/p/12350676.html