I'm new to Jenkins.
My goal is to create a Jenkins job\pipeline that will activate a group of ansible's playbook files - which will create
a long installation of my tested product.
I build 2 containers in Docker desktop (Windows): Ansible and Jenkins.
Below Ansible docker-compose.yml file:
version: '2'
services:
ansible:
container_name: ansible
hostname: ansible
image: ansible
volumes:
- ~/product/ansible:/ansible
working_dir: /ansible
build:
context: .
dockerfile: Dockerfile
dns:
- 200.20.0.20
networks:
- network
networks:
network:
external: true
Below Jenkins docker-compose.yml file:
version: '3.7'
services:
jenkins:
container_name: jenkins
image: jenkins/jenkins:lts
privileged: true
user: root
ports:
- 8080:8080
- 50000:50000
container_name: jenkins
volumes:
- ~/r10_core/jenkins:/jenkins
networks:
- network
networks:
network:
external: true
Ansible and Jenkins are on the same Network Id. So, ping
command is working from Ansible to Jenkins and vis versa. Both containers have access to Internet.
I set username and password admin | admin and installed the following plugins in Jenkins container through Jenkins site > Manage Jenkins > Manage Plugins:
- Ansible plugin
- SSH
- Publish by SSH
I checked the SSH services in both machines.
Ansible:
[root@ansible ansible]# ssh 172.20.0.2
ssh: connect to host 172.20.0.2 port 22: Connection refused
[root@ansible ansible]# service --status-all
bash: service: command not found
[root@ansible ansible]# systemd
bash: systemd: command not found
[root@ansible ansible]# systemctl
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[root@ansible ansible]#
Jenkins:
root@jenkins:/# ssh 172.20.0.3
ssh: connect to host 172.20.0.3 port 22: Connection refused
root@jenkins:/# service --status-all
[ ? ] hwclock.sh
root@jenkins:/#
I got a Connection refused
also when trying to connect to the machines themselves
a) What should I configure in the Ansible container in order SSH to be active?
b) What should I configure in the Jenkins container in order SSH to be active?
c) What should I configure in each container in order them talk each other through SSH (i.e port 22)?