Giter Site home page Giter Site logo

william-yeh / docker-ansible Goto Github PK

View Code? Open in Web Editor NEW
401.0 20.0 158.0 132 KB

Docker images for Ansible software, installed in a selected Linux distributions (Debian/Ubuntu/CentOS/Alpine).

Home Page: https://hub.docker.com/r/williamyeh/ansible/

License: Apache License 2.0

Shell 27.76% Dockerfile 72.24%
docker ansible

docker-ansible's Introduction

Docker-Ansible base images

Circle CI Build Status

Summary

Repository name in Docker Hub: williamyeh/ansible

This repository contains Dockerized Ansible, published to the public Docker Hub via automated build mechanism.

Configuration

These are Docker images for Ansible software, installed in a selected Linux distributions.

Base OS

Debian (stretch, jessie), Ubuntu (bionic, xenial, trusty), CentOS (7), Alpine (3).

Supports for Wheezy, Precise, and CentOS6 have been ended since Sep 2017.

Ansible

Four versions are provided:

  1. provides the most recent stable version of Ansible; suitable for most people.
  2. same as stable version, but is designed for building (near-)minimal images out of playbooks; i.e., the Ansible body will be removed when mission completed. Refer to “Build Docker images with Ansible: A half-blood approach” for working examples and slides.
  3. provides the old 1.9 version of Ansible (but will be retired someday).
  4. provides the experimental version of Ansible; i.e., the master branch of official Ansible's git repo.

Each version is further divided into two variants:

  • Normal variant: intended to be used as Ansible control machines, or in cases that is inadequate in the onbuild variants.
  • Onbuild variant: intended to be used to build Docker images.

Images and tags

Stable version (installed from official PyPI repo):

  • Normal variants:

    • williamyeh/ansible:debian9
    • williamyeh/ansible:debian8
    • williamyeh/ansible:ubuntu18.04
    • williamyeh/ansible:ubuntu16.04
    • williamyeh/ansible:ubuntu14.04
    • williamyeh/ansible:centos7
    • williamyeh/ansible:alpine3
  • Onbuild variants (recommended for common cases):

    • williamyeh/ansible:debian9-onbuild
    • williamyeh/ansible:debian8-onbuild
    • williamyeh/ansible:ubuntu18.04-onbuild
    • williamyeh/ansible:ubuntu16.04-onbuild
    • williamyeh/ansible:ubuntu14.04-onbuild
    • williamyeh/ansible:centos7-onbuild
    • williamyeh/ansible:alpine3-onbuild

Minimal configuration (the Ansible body will be removed when mission completed):

Refer to “Build Docker images with Ansible: A half-blood approach” for working examples and slides.

  • Onbuild variants:

    • williamyeh/ansible:mini-alpine3
    • williamyeh/ansible:mini-debian9
    • williamyeh/ansible:mini-debian8

Old 1.9 version (will be retired someday):

Note: Ansible 1.9 was not supported in CentOS EPEL since January 2017, according to this announcement.

  • Normal variants:

    • williamyeh/ansible:1.9-debian8
    • williamyeh/ansible:1.9-ubuntu14.04
    • williamyeh/ansible:1.9-alpine3
  • Onbuild variants (recommended for common cases):

    • williamyeh/ansible:1.9-debian8-onbuild
    • williamyeh/ansible:1.9-ubuntu14.04-onbuild
    • williamyeh/ansible:1.9-alpine3-onbuild

Experimental version (building directly from the git master source tree; use at your own risk!):

  • Normal variants:

    • williamyeh/ansible:master-debian9
    • williamyeh/ansible:master-debian8
    • williamyeh/ansible:master-ubuntu18.04
    • williamyeh/ansible:master-ubuntu16.04
    • williamyeh/ansible:master-centos7
  • Onbuild variants (recommended for common cases):

    • williamyeh/ansible:master-debian9-onbuild
    • williamyeh/ansible:master-debian8-onbuild
    • williamyeh/ansible:master-ubuntu18.04-onbuild
    • williamyeh/ansible:master-ubuntu16.04-onbuild
    • williamyeh/ansible:master-centos7-onbuild

For the impatient

Here comes a simplest working example for the impatient.

First, choose a base image you'd like to begin with. For example, williamyeh/ansible:ubuntu16.04-onbuild.

Second, put the following Dockerfile along with your playbook directory:

FROM williamyeh/ansible:ubuntu16.04-onbuild

# ==> Specify requirements filename;  default = "requirements.yml"
#ENV REQUIREMENTS  requirements.yml

# ==> Specify playbook filename;      default = "playbook.yml"
#ENV PLAYBOOK      playbook.yml

# ==> Specify inventory filename;     default = "/etc/ansible/hosts"
#ENV INVENTORY     inventory.ini

# ==> Executing Ansible (with a simple wrapper)...
RUN ansible-playbook-wrapper

Third, docker build .

Done!

For more advanced usage, the role in Ansible Galaxy williamyeh/nginx demonstrates how to perform a simple smoke test (configuration needs test, too!) on a variety of (containerized) Linux distributions on CircleCI's Ubuntu 12.04 and Travis CI’s Ubuntu 14.04 worker instances.

Why yet another Ansible image for Docker?

There has been quite a few Ansible images for Docker (e.g., search in the Docker Hub), so why reinvent the wheel?

In the beginning I used the ansible/ansible-docker-base created by Ansible Inc. It worked well, but left some room for improvement:

  • Base OS image - It provides only centos:centos7 and ubuntu:14.04. Insufficent for me.

  • Unnecessary dependencies - It installed, at the very beginning of its Dockerfile, the software-properties-common package, which in turns installed some Python packages. I prefered to incorporate these stuff only when absolutely needed.

Therefore, I built these Docker images on my own.

NOTE: ansible/ansible-docker-base announced in September 2015: “Ansible no longer maintains images in Dockerhub directly.”

Comparison: image size

REPOSITORY                    TAG                   VIRTUAL SIZE
---------------------------   -------------------   ------------
ansible/centos7-ansible       stable                367.5 MB
ansible/ubuntu14.04-ansible   stable                286.6 MB

williamyeh/ansible            alpine3-onbuild        66.4 MB
williamyeh/ansible            centos6-onbuild       264.2 MB
williamyeh/ansible            centos7-onbuild       275.3 MB
williamyeh/ansible            debian7-onbuild       134.4 MB
williamyeh/ansible            debian8-onbuild       178.3 MB
williamyeh/ansible            ubuntu12.04-onbuild   181.9 MB
williamyeh/ansible            ubuntu14.04-onbuild   238.3 MB

Usage

Used mostly as a base image for configuring other software stack on some specified Linux distribution(s).

Take Debian/Ubuntu/CentOS for example. To test an Ansible playbook.yml against a variety of Linux distributions, we may use Vagrant as follows:

# Vagrantfile

Vagrant.configure(2) do |config|

    # ==> Choose a Vagrant box to emulate Linux distribution...
    config.vm.box = "ubuntu/xenial64"
    #config.vm.box = "ubuntu/trusty64"
    #config.vm.box = "debian/stretch64"
    #config.vm.box = "debian/jessie64"
    #config.vm.box = "bento/centos-7.2"
    #config.vm.box = "maier/alpine-3.3.1-x86_64"


    # ==> Executing Ansible...
    config.vm.provision "ansible" do |ansible|
        ansible.playbook = "playbook.yml"
    end

end

Virtual machines can emulate a variety of Linux distributions with good quality, at the cost of runtime overhead.

Docker to be a rescue. Now, with these williamyeh/ansible series, we may test an Ansible playbook.yml against a variety of Linux distributions as follows:

# Dockerfile

# ==> Choose a base image to emulate Linux distribution...
FROM williamyeh/ansible:ubuntu16.04
#FROM williamyeh/ansible:ubuntu14.04
#FROM williamyeh/ansible:debian9
#FROM williamyeh/ansible:debian8
#FROM williamyeh/ansible:centos7
#FROM williamyeh/ansible:alpine3


# ==> Copying Ansible playbook...
WORKDIR /tmp
COPY  .  /tmp

# ==> Creating inventory file...
RUN echo localhost > inventory

# ==> Executing Ansible...
RUN ansible-playbook -i inventory playbook.yml \
      --connection=local --sudo

You may also work with onbuild variants, which take care of many routine steps for you:

# Dockerfile

# ==> Choose a base image to emulate Linux distribution...
FROM williamyeh/ansible:ubuntu16.04-onbuild
#FROM williamyeh/ansible:ubuntu14.04-onbuild
#FROM williamyeh/ansible:debian9-onbuild
#FROM williamyeh/ansible:debian8-onbuild
#FROM williamyeh/ansible:centos7-onbuild
#FROM williamyeh/ansible:alpine3-onbuild


# ==> Specify requirements filename;  default = "requirements.yml"
#ENV REQUIREMENTS  requirements.yml

# ==> Specify playbook filename;      default = "playbook.yml"
#ENV PLAYBOOK      playbook.yml

# ==> Specify inventory filename;     default = "/etc/ansible/hosts"
#ENV INVENTORY     inventory.ini

# ==> Executing Ansible (with a simple wrapper)...
RUN ansible-playbook-wrapper

With Docker, we can test any Ansible playbook against any version of any Linux distribution without the help of Vagrant. More lightweight, and more portable across IaaS, PaaS, and even CaaS (Container as a Service) providers!

If better OS emulation (virtualization) isn't required, the Docker approach (containerization) should give you a more efficient Ansible experience.

License

Author: William Yeh [email protected]

Licensed under the Apache License V2.0. See the LICENSE file for details.

docker-ansible's People

Contributors

joaocc avatar william-yeh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-ansible's Issues

Ansible pip modules for additional features

Hello,
can you intergrate following python modules?

PIP module Ansible module
pyexpect expect
boto ec2, etc.
apache-libcloud gce, etc.
azure + msrestazure or ansible[azure] azure_*

Thank you.

Best,
Claudio

Add cryptography library for ansible-vault

Hi,

I really need to be able to run ansible-vault command from the container but I get an error because it's missing the cryptography dependency.

Would be great to add it

Thanks a lot !

Specifying ansible version

I've found that using these images massively speeds up my build times, thanks for your work :)

The only trouble is I need to test against specific versions of ansible.. but the way you build ansible (clone, build, move relevant files and remove cruft) wont allow me to change the ansible version..

Had you thought about install from pip so that the version can be changed? or leaving the git repo intact so users can checkout the relevant tag?

Thanks again!

error updating /etc/hosts file on cenotos7

Hi there,

I've been trying to run an ansible script on centos7. Any idea why that would be?
Or is the use of ansible limited in some way?

This is my setup:

FROM williamyeh/ansible:centos7

# general update
RUN yum -y update

ADD ./ /tmp/ansible

RUN ansible-playbook --sudo --connection=local -vvv -e restart=true -e scratch_build=false -e serial=10 -i /tmp/ansible/docker-nodes /tmp/ansible/site.yml

This is the error I get:

TASK: [node | generate hosts file] ********************************************
<127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1444078648.91-266229075750000 && echo $HOME/.ansible/tmp/ansible-tmp-1444078648.91-266229075750000']
<127.0.0.1> EXEC ['/bin/sh', '-c', u'rc=flag; [ -r /etc/hosts ] || rc=2; [ -f /etc/hosts ] || rc=1; [ -d /etc/hosts ] && rc=3; python -V 2>/dev/null || rc=4; [ x"$rc" != "xflag" ] && echo "${rc} "/etc/hosts && exit 0; (python -c \'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1();\nafile = open("\'/etc/hosts\'", "rb")\nbuf = afile.read(BLOCKSIZE)\nwhile len(buf) > 0:\n\thasher.update(buf)\n\tbuf = afile.read(BLOCKSIZE)\nafile.close()\nprint(hasher.hexdigest())\' 2>/dev/null) || (python -c \'import sha; BLOCKSIZE = 65536; hasher = sha.sha();\nafile = open("\'/etc/hosts\'", "rb")\nbuf = afile.read(BLOCKSIZE)\nwhile len(buf) > 0:\n\thasher.update(buf)\n\tbuf = afile.read(BLOCKSIZE)\nafile.close()\nprint(hasher.hexdigest())\' 2>/dev/null) || (echo \'0 \'/etc/hosts)']
<127.0.0.1> PUT /tmp/tmpce0XQc TO /root/.ansible/tmp/ansible-tmp-1444078648.91-266229075750000/source
<127.0.0.1> PUT /tmp/tmp5F2W8p TO /root/.ansible/tmp/ansible-tmp-1444078648.91-266229075750000/copy
<127.0.0.1> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=xluifxkeyvhjkjvbfusnehjxzdipsqpp] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-xluifxkeyvhjkjvbfusnehjxzdipsqpp; LANG=C LC_CTYPE=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1444078648.91-266229075750000/copy; rm -rf /root/.ansible/tmp/ansible-tmp-1444078648.91-266229075750000/ >/dev/null 2>&1'"'"''
failed: [127.0.0.1] => {"failed": true}
msg: Could not replace file: /root/.ansible/tmp/ansible-tmp-1444078648.91-266229075750000/source to /etc/hosts: [Errno 16] Device or resource busy

Installing git via ansible-playbook-wrapper does not work

When using the ansible-playbook-wrapper script to install requirements and run a playbook, requirements that are downloaded via git will fail because the apt-get install -y git command (https://github.com/William-Yeh/docker-ansible/blob/master/debian9-onbuild/ansible-playbook-wrapper#L26) fails:

build	21-Nov-2017 09:12:16	Reading package lists...
build	21-Nov-2017 09:12:16	Building dependency tree...
build	21-Nov-2017 09:12:16	Reading state information...
error	21-Nov-2017 09:12:16	E: Unable to locate package git

This, in turn, is because the Dockerfile removes the APT packages information: https://github.com/William-Yeh/docker-ansible/blob/master/debian9-onbuild/Dockerfile#L33

A possible fix would be to run apt-get update before the apt-get install.

Cannot locate file using ubuntu images

I have four docker files to test an ansible role, two for ubuntu and two more for debian. The dockerfiles for debian work as expected, but the ubuntu images cannot find my test.sh script.

Here's one of the Dockerfile that fail:

FROM williamyeh/ansible:ubuntu12.04

RUN apt-get update
CMD ["sh", "tests/test.sh"]

EXPOSE 6379

Using this Dockerfile I get a not found error:

Sending build context to Docker daemon  29.7 kB
Step 0 : FROM williamyeh/ansible:ubuntu12.04
 ---> f5487bd0d179
Step 1 : RUN apt-get update
 ---> Using cache
 ---> fe89445b30c4
Step 2 : CMD sh tests/test.sh
 ---> Using cache
 ---> 88e011b60b7a
Step 3 : EXPOSE 6379
 ---> Using cache
 ---> 50478e7766de
Successfully built 50478e7766de
sh: 0: Can't open tests/test.sh

I have exactly the same files for debian:

FROM williamyeh/ansible:debian7-onbuild

RUN apt-get update
CMD ["sh", "tests/test.sh"]

EXPOSE 6379

And debian builds work as expected.

Amb I doing something wrong? Or it could be something with the ubuntu images?

If you want you can check both the role and its travis build.

Thanks in advance for any help.

Ansible-vault non-functioning

Reopening a vault issue since the "debian8" and "debian9" tags don't have the appropriate libraries.

ERROR! ansible-vault requires either the cryptography library (preferred) or pycrypto in order to function. for /data/environments/test/stacks/opgen-api/secrets/opgen-api-config

what to do about python2 deprecation in 2020

'twas using your alpine3 base image, and ran a few pip upgrades myself to get "latest-latest" going on an internal docker image

Step 9/12 : RUN pip install --upgrade pip
 ---> Running in 752a09df9528
Collecting pip
  Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-19.0.3
Removing intermediate container 752a09df9528
 ---> 1f319e283a90
Step 10/12 : RUN pip install --upgrade       pip       cffi       ansible       pycrypto
 ---> Running in 3a9855c0f86e

But yikes:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.

https://pythonclock.org/

Looks like over the next 6 months or so need to flip over to python3 entirely!

centos6-onbuild from Docker Hub is missing ansible

We began getting these errors when using the williamyeh/ansible:centos6-onbuild image from Docker Hub today:

14:52 $ docker build -f Dockerfile.centos6 .
Sending build context to Docker daemon 67.58 kB
Step 1 : FROM williamyeh/ansible:centos6-onbuild
# Executing 3 build triggers...
Step 1 : WORKDIR /tmp
 ---> Using cache
Step 1 : COPY . /tmp
Step 1 : RUN echo "===> Diagnosis: host information..."  &&               ansible -c local -m setup all
 ---> Running in d6544af25ff1
/bin/sh: ansible: command not found
===> Diagnosis: host information...
The command '/bin/sh -c echo "===> Diagnosis: host information..."  &&               ansible -c local -m setup all' returned a non-zero code: 127

The same build using williamyeh/ansible:ubuntu14.04-onbuild works as expected, however.

14:52 $ docker build -f Dockerfile.ubuntu14.04 .
Sending build context to Docker daemon 67.58 kB
Step 1 : FROM williamyeh/ansible:ubuntu14.04-onbuild
# Executing 4 build triggers...
Step 1 : RUN DEBIAN_FRONTEND=noninteractive  apt-get update   &&               echo "===> Updating TLS certificates..."         &&               apt-get install -y openssl ca-certificates
 ---> Using cache
Step 1 : WORKDIR /tmp
 ---> Using cache
Step 1 : COPY . /tmp
Step 1 : RUN echo "===> Diagnosis: host information..."  &&               ansible -c local -m setup all
 ---> Running in 5d8f9119fc6e
===> Diagnosis: host information...
localhost | SUCCESS => {
...

It seems that these two were created just a couple of days ago. Might an incomplete centos6 image have been pushed to Docker Hub?

14:53 $ docker images
REPOSITORY                   TAG                   IMAGE ID            CREATED             SIZE
williamyeh/ansible           ubuntu14.04-onbuild   003bb48235a5        2 days ago          244.8 MB
williamyeh/ansible           centos6-onbuild       5adc005fb767        2 days ago          332.9 MB

Set .ssh/config and .ssh/known_hosts

TL;DR

  • Would be nice to have a user other than root to perform commands in the container (bonus point if this user has a the same pid than the host user).
  • Document ssh custom configuration.

I first wanted to authenticate on my server with my ssh key. Found that mounting the ssh agent socket as volume would be a reasonable solution.

To go further, for security purposes (forcing secure algorithms, servers signatures, etc.), I would like to be able to pass my host config and known_hosts files to the container.

This is what my docker run command look so far:

docker run \
  --name ansible-playbook \
  -it --rm \
  --volume $(pwd):/home/ansible/project \
  -w /home/ansible/project \
  --volume $SSH_AUTH_SOCK:/ssh-agent --env SSH_AUTH_SOCK=/ssh-agent \
  --volume ${HOME}/.ssh/config:/root/.ssh/config:ro \
  --volume ${HOME}/.ssh/known_hosts:/root/.ssh/known_hosts:ro \
  williamyeh/ansible:ubuntu14.04 \
  ansible-playbook"

When doing so with the current image, I hit a Bad owner or permissions on /root/.ssh/config.

# ls -alh /root/.ssh
drwxr-xr-x 2 root root 4.0K Apr 29 05:11 .
drwx------ 3 root root 4.0K Apr 29 05:11 ..
-rw------- 1 1000 1000 1.6K Apr 29 05:11 config
-rw------- 1 1000 1000 8.3K Apr 25 05:17 known_hosts

Yep: files are mounted with the owner id from the host, which is not present in the container.

Therefore, I created a "custom image" to extend the behaviour as such:

FROM williamyeh/ansible:ubuntu14.04

RUN adduser -u 1000 --disabled-password ansible
USER ansible

... and now, I am able to use the following command successfully (note the slight changes in the volumes destinations):

docker run \
  --name ansible-playbook \
  -it --rm \
  --volume $(pwd):/home/ansible/project \
  -w /home/ansible/project \
  --volume $SSH_AUTH_SOCK:/ssh-agent --env SSH_AUTH_SOCK=/ssh-agent \
  --volume ${HOME}/.ssh/config:/home/ansible/.ssh/config:ro \
  --volume ${HOME}/.ssh/known_hosts:/home/ansible/.ssh/known_hosts:ro
  ${ansible_image} \
  ansible-playbook"

Thanks for reading, happy to hear your thoughts on that.

using williamyeh/ansible:centos7, Enable the Docker daemon in systemd failing

Using

- name: Enable the Docker daemon in systemd
  systemd:
    name: docker
    enabled: yes
    masked: no 

results in.
Job #45811 failed for 028da0c0:
"systemctl", "status", "docker"], "delta": "0:00:00.351030", "end": "2019-07-11 18:13:46.479587", "msg": "non-zero return code", "rc": 1, "start": "2019-07-11 18:13:46.128557", "stderr": "Failed to get D-Bus connection: Operation not permitted", "stderr_lines": ["Failed to get D-Bus connection: Operation not permitted"]

No rsync in ansible:alpine3

Hello,
I have a playbook with a basic synchronize command.
Executing this playbook on a docker ansible:alpine3 container gives me this error:

fatal: [hbsded001]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to find required executable rsync"}

Is this per-design or rsync is really missing? Can you add it to the image?

Thank you

Offer distinct Ansible versions

This is a nice repository, but I miss the ability to choose between different Ansible versions, so test playbooks against different Ansible versions would be really easy.
I'd keep at least a different image for every minor version, like 1.9, 2.0, 2.1, and so on.

Dockerfile modif request

Upon installing python related modules you do a cleanup during which you also remove python-pip. It would helpful to not remove this in order to use ansible pip module. Particularly when developing and testing python stacks this is nice to have. It would also be nice to have virtualenv module installed

node connection failed

fatal: [nodename]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp". Failed command was: ( umask 77 && mkdir -p "echo ~/.ansible/tmp/ansible-tmp-1532358609.48-136631691249635" && echo ansible-tmp-1532358609.48-136631691249635="echo ~/.ansible/tmp/ansible-tmp-1532358609.48-136631691249635" ), exited with result 3", "unreachable": true}

while using centos container its works fine.
Whats the issue with alpine container.?

Missing python-requests in CentOS image

Getting this issue: ERROR! This script requires python-requests 1.1 as a minimum version

Please build this into the image or extend script to install 'extra' packages (similar to the 'requirements.txt' file but for packages...

Galaxy from git fails with debian9-onbuild

Using pre-built package williamyeh/ansible:debian9-onbuild

Following line will fail, as the apt cache was removed during docker build.

export REQUIREMENTS=requirements.yml
/usr/local/bin/ansible-playbook-wrapper
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package git

->

apt update
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:4 http://deb.debian.org/debian stretch Release [118 kB]
Get:5 http://deb.debian.org/debian stretch Release.gpg [2434 B]
Get:6 http://deb.debian.org/debian stretch-updates/main amd64 Packages [27.4 kB]
Get:7 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [502 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 Packages [7082 kB]
Fetched 7918 kB in 2s (3799 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
24 packages can be upgraded. Run 'apt list --upgradable' to see them.

/usr/local/bin/ansible-playbook-wrapper
Reading state information... Done
The following additional packages will be installed:
  git-man less libbsd0 libcurl3-gnutls libedit2 liberror-perl libgdbm3 libgpm2 libncurses5 libperl5.24 libpopt0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6
  libxmuu1 netbase openssh-client patch perl perl-base perl-modules-5.24 rename rsync xauth 
.........

Typo in centos Dockerfile results in broken inventory file

e.g. line 43 of centos7-onbuild/Dockerfile:

echo '[local]\nlocalhost\n' > /etc/ansible/hosts

Echo should have the option -e set, or the escape sequences \n will not be interpreted.

echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts

Ansible vault support

ERROR! ansible-vault requires either the cryptography library (preferred) or pycrypto in order to function.
Need python-crypto/pycrypto package for correct work ansible-vault.

Host file not found: inventory/local

Hi,
I feel I must be missing something obvious, but I'm not able to make ansible see the inventory I have in a local file.
I'm using the image like this:

docker run --rm -it williamyeh/ansible:ubuntu16.04 ansible -m ping -i inventory/local all

The response I get is:

 [WARNING]: Host file not found: inventory/local

 [WARNING]: provided hosts list is empty, only localhost is available

 [WARNING]: No hosts matched, nothing to do

The inventory I'm referencing is:

cat ./inventory/local
[mysql]
localhost ansible_port=2222

[jira]
localhost ansible_port=2222

[confluence]
localhost ansible_port=2222

What am I doing wrong?

Thank you

Tag Docker images including the Ansible version

Today I hit an issue with a script for Ansible 2.3.0 that failed with Ansible 2.4.0. The image I used is williamyeh/ansible:debian8. This image has been recently updated to 2.4.0 reusing the same tag.

Thankfully I found on my docker-machine an older tag. I've pushed it in https://hub.docker.com/r/ddragosd/ansible/ but it would be nice to delete this clone.

The tags are prefixed with the Ansible version. i.e.

  • 2.4.0.0-debian8
  • 2.3.1.0-debian8

Missing py-netaddr for alpine image

Hi,

From a ansible template i am using the ipaddr filter like this sample

{{ '10.10.0.1/24' | ipaddr('address') }}

Running this template with docker image williamyeh/ansible:alpine3 will throw this ansible error

The ipaddr filter requires python-netaddr be installed on the ansible controller

Installing it on hosts does not help. Is it possible to add this statement inside the Dockerfile ?

apk add py-netaddr

Maybe you prefere a pull request than an issue ?

Source:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters_ipaddr.html

Regards,

alpine: py-pip has been renamed to py2-pip

FYI

Here:
https://github.com/William-Yeh/docker-ansible/blob/master/alpine3/Dockerfile#L20
, the py-pip package is installed using apk on the alpine flavour:

 apk --update add python py-pip openssl ca-certificates && \

However AFAIK, the py-pip package was at some point in the past renamed to simply py2-pip. Therefore I would suspect this action to fail on your alpine builds.

py-pip search: NO RESULTS
https://pkgs.alpinelinux.org/packages?name=py-pip&branch=edge


It looks like this happened as of alpine version 3.4
py-pip search: YIELDS RESULTS
https://pkgs.alpinelinux.org/packages?name=py-pip&branch=v3.4&arch=x86_64

vs.

py-pip search: NO RESULTS
https://pkgs.alpinelinux.org/packages?name=py-pip&branch=v3.5&arch=x86_64

vs.

py2-pip search: YIELDS RESULTS
https://pkgs.alpinelinux.org/packages?name=py2-pip&branch=v3.5&arch=x86_64

'ansible: command not found' at centos6-onbuild image

I can't found the ansible command at docker image of williamyeh/ansible:centos6-onbuild.

$ docker images | grep williamyeh/ansible | grep centos
williamyeh/ansible          centos6-onbuild       51f492c73235        7 weeks ago         332.9 MB
williamyeh/ansible          centos7-onbuild       829b38476c2e        7 weeks ago         277.4 MB

$ docker run -it williamyeh/ansible:centos6-onbuild bash
[root@776fd5b42974 /]# ansible --version
bash: ansible: command not found

Please rebuild it, again. Thank you.

release frequencies?

William,
What is the release frequency for this image?
It seems like it is currently at Ansible 1.9.2, while Ansible official release is 1.9.3.1 as of today.

No git in ubuntu/debian images

It's currently not possible to use ansible-galaxy with roles from git, like this:

- src: ssh://[email protected]/rvdh/some-ansible-role.git
  scm: git

Right now I fixed this by adding git to the packages in the dockerfile, but maybe this can be fixed here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.