Ansible On Docker

preview_player
Показать описание
This Video tutorial is aiming to extend the docker knowledge gained so far and using it to run ANSIBLE inside DOCKER containers. Here we are discussing some basis docker management commands and Ansible commands as well: A basic step documentation is below:

Automate EVERYTHING with Ansible! (Ansible for Beginners)

ANSIBLE ON DOCKER

2. Building Docker images:

# docker build -f Dockerfile -t ansible-master .
# docker build -f Dockerfile1 -t ansible-slave .
3. Spinning the containers:

# docker run -d --privileged --name ansiblemaster ansible-master
# docker run -d --privileged --name ansibleslave ansible-client

4. Identifying IP's to connect:

# docker inspect ansiblemaster | grep IPAddress
5. Connecting to docker instance:

# docker exec -it ansiblemaster /bin/bash

You can also test our pre-generated docker images for your testing as well

hgangwar/ansible-centos-client Ansible managed host 0
hgangwar/ansible-centos-master Ansible master 0
Рекомендации по теме
Комментарии
Автор

Thanks for the video. Some notes to update is that I had to use python virtual environment to install ansible, and I also had to configure SSH server and entrypoint sshd, rather than systemd. Systemd doesn't work for containers (at least it wasn't working for me).

danialahmed
Автор

Great video, exactly what I needed. I am new to Linux. Will try to build an image. Thanks once again

mayankjoshi
Автор

I got the error Step 7/15 : ADD id_rsa .
ADD failed: file not found in build context or excluded by .dockerignore: stat id_rsa: file does not exist

LijiTijil
Автор

I cannot build an image.
executing: docker build -f Dockerfile -t ansible-master .
I have a problem with epel-release or ansible to install, not sure.


# yum install ansible
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile


One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:

1. Contact the upstream for the repository and get them to fix the problem.

2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).

3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...

4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:

yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>

5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:

yum-config-manager --save

Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again

marcinsak