After reviewing this amazing forum, i thought it's time to join in...
I'm having issue with a playbook that deploys multiple Dockers.
My Ansible version is: 2.5.1
My Python version is 3.6.9
My Linux Images are 18.04 from the site: OSboxes.
Docker service is installed and running on both of the machines.
According to this website, all you need to do is follow the instructions and everything will work perfectly. :)
https://www.techrepublic.com/article/how-to-deploy-a-container-with-ansible/
(The playbook i use is in the link above)
but after following the steps, and using the playbook, i've got this error.
TASK [Pull default Docker image] ******************************************************************************************************
fatal: [192.168.1.38]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (docker_image) module: source Supported parameters include: api_version, archive_path, buildargs, cacert_path, cert_path, container_limits, debug, docker_host, dockerfile, filter_logger, force, http_timeout, key_path, load_path, name, nocache, path, pull, push, repository, rm, ssl_version, state, tag, timeout, tls, tls_hostname, tls_verify, use_tls"}
I'll be happy for your support on this issue.
The source: pull option was added in Ansible 2.8. Since you are using Ansible 2.5.1, that option is not available.
You can either use a later version, 2.8 or above, or just remove that line from your playbook and it should work:
- name: Pull default Docker image
docker_image:
name: "{{ default_container_image }}"
You won't have the guarantee that the image has been newly pulled from a registry. If that's important in your case, you can remove any locally cached version of the image first:
- name: Remove Docker image
docker_image:
name: "{{ default_container_image }}"
state: absent
- name: Pull default Docker image
docker_image:
name: "{{ default_container_image }}"
So according to the doc of docker_image module of Ansible 2.5, there is indeed no parameter source.
Nevertheless, the doc of version 2.9 tells us it has been "added in 2.8"! So you have to update you Ansible version to be able to run the linked playbook as-is. That's you best option.
Otherwise, another option would be to keep your version 2.5 and simply remove the line 38.
(-) source: pull
But I don't know how was the default behaviour before 2.8, so I cannot garanty you that it will do what you expect!
Finally, got this playbook to sing! :)
I did the following.
upgraded the Ansibe version, so now it's running on version: 2.9.15.
my python3 version is:3.6.9
After upgrading the Ansible to the version i've mentioned above, i got and error message: Failed to import the required python library (Docker SDK for Python (python >==2.7) or docker-py (python 2.6)) on osboxes(this is my machine) python...
so, after Googling this error, i found this URL:
https://neutrollized.blogspot.com/2018/12/cannot-have-both-docker-py-and-docker.html
SO, i decided to remove the docker from my machines, including the python that was installed using pip (i used the command pip-list to see if there is docker installed, and remove it using: pip uninstall).
After removing the Docker from my machines, i added the playbook one more play. install docker-compose (that's what solve my problem, and it took care of the python versions).
Just follow the URL i attached in my answer.
According the error message in Ansible module docker_image a parameter seems to be used, which is not part of the parameters implemented for that module (yet). Also the error message lists already the parameter which are available. Same as in the documentation for the module.
An other possible reason might be that the line indent for some of the parameters isn't correct.
Related
As it is right now, it's possible to docker build an image using the community.docker collection:
(Example from documentation)
- name: Build an image and push it to a private repo
community.docker.docker_image:
build:
path: ./sinatra
name: registry.ansible.com/chouseknecht/sinatra
tag: v1
push: yes
source: build
My question is simple. According to their documentation, the platform field only seems to allow for one architecture:
Platform in the format os[/arch[/variant]].
(Notice "platform" and not "platforms" and that type is "string" and not a list of strings)
Is it possible to multiarch build (for example, an amd64 and arm) using the community.docker collection? Of course, I can use shell/command instead using something like:
- name: Multiarch build
shell: |
docker buildx build --platform amd64,arm --push -t myimage .
But is it possible using what's available now within the collection?
I'm new to using Ansible to building Docker images, but I wanted to do this too and agree that specifying multiple platforms doesn't appear to be supported, so I put in a feature request on their GitHub here: https://github.com/ansible-collections/community.docker/issues/467.
Just to see what happened, I tried setting build.platform to "linux/arm64,linux/amd64", and the answer is that nothing happens. Ansible said that it was okay and nothing changed, even when I made an edit to the Dockerfile that should've triggered a build. I found that the same happens if I specify an invalid platform name.
I am trying to install VECTR on the GCP Ubuntu instance and following the official writeup for the same.
I used apt-get to install requirements (docker-ce, docker-ce-cli, containerd.io, docker-compose, unzip) on Ubuntu (GCP).
But while trying to run docker-compose up -d , I am getting issues with the docker-compose version.
ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") and place your service definitions under the services key, or omit the version key and place your service definitions at the root of the file to use version 1.
Changed docker-compose.yml file and padded version to 2.
But now getting a different issue:
ERROR: Invalid interpolation format for "ports" option in service "tomcat": "${VECTR_PORT:-8081}:8443"
The docker-compose distro has been deprecated. Instead, you should install docker-compose-plugin. This is going to be more important over time because the versions are getting very far apart (currently 1.25.X vs 2.6.X). Instead of executing docker-compose up, you will now execute the command:
docker compose up
I have a Dockerfile for MariaDB 10.1.26 which I use in connection with SphixSE.
Defining Dockerfiles for versions 10.4.18 and 10.5.9 along the same lines is easy, but SphinxSE cannot be installed.
Specifically the command INSTALL SONAME 'ha_sphinx'; raises an enigmatic error.
What can I do to make it work with these versions, too?
For the time being it cannot be done.
https://git.alpinelinux.org/aports/tree/main/mariadb/APKBUILD#n162 shows that the package does not support SphinxSE.
https://github.com/MariaDB/mariadb-docker/pull/343 shows that MariaDB does not support Alpine.
I'm tried creating a job template in AWX web interface.
the list of playbooks is not displayed on the interface although the project has been downloaded to git and is visible in the directory ~/var/lib/awx/projects.
my environment:
centOS 8
AWX 17.0.1
Ansible 2.9.17
docker-compose 1.28.2
The yml file must not be empty and must have right syntax.
After that , always sync project and then check
I had this same challenge when creating a new Job Template on Ansible AWX setup on Ubuntu 20.04.
I created some playbooks in a repository that was added to a project. I then created a Job Template and selected the Project, but none of the playbooks were added to the project.
My playbook looked this way:
- name: Check if SSHD is running
command: systemctl status ssh
ignore_errors: yes
Here's how I fixed it:
I simply added hosts to the playbook and it showed up on the Job template for me to select. So my playbook was modified to look this way:
- name: Check if SSHD is running
hosts: all
command: systemctl status ssh
ignore_errors: yes
Note: The value for hosts could be something else. For me, it was all.
Resources: Playbooks aren’t showing up in the “Job Template” drop-down
That's all.
I hope that helps
I had the same problem. Once I made sure my git repo was up-to-date, I manually typed in the playbook name in the awx template creation screen, and my playbook was selected.
I'm trying to deploy the official CGAL docker. From reading the README I understand that after downloading the specific image (e.g I want to open a docker with ubuntu16+CGAL and all of it's dependencies) using the following command:
docker pull cgal/testsuite-docker:ubuntu # get a specific image by replacing TAG with some tag
I need to install the cgal library itself using the
./test_cgal.py --user **** --passwd **** --images cgal-testsuite/ubuntu
The thing is that eventually I want to start the docker with an interactive shell, i.e
docker run --rm -it -v $(pwd):/source somedocker
And I couldn't understand where is the generated image, after the CGAL installation script.
Those images are not for running CGAL. They are only images we use to define an environment for our testsuite, and run tests in it, including compiling CGAL.
test_cgal.py will download the integration branch, which is rarely working as it is the branch in which we merge our PR to test them nightly. Don't use this to get a working CGAL. To my knowledge, there is no such image as the one you are looking for. No official one anyways.
Furthermore, installing cgal at runtime in this image will not modify the image, once you close the container your installation will be lost. You need to specify how to install CGA in the Dockerfile of your image and
then build it if you want a "ready to use" image.
You can use the dockerfile of the image you found to write your own, as there should be all the dependencies specified in it, but you need to edit it to download CGAL and maybe build it if you don't want the header-only version. This is not done in test-cgal.py or anywhere in this docker repository.