I could use some help.
I was tasked to install check-mk (Nagios) through Docker through ansible. I managed to install docker but I can't make it install check-mk through ansible...
The command to install check-mk is:
docker container run -dit -p 8080:5000 --ulimit nofile=1024 --tmpfs /opt/omd/sites/cmk/tmp:uid=1000,gid=1000 -v monitoring:/omd/sites --name monitoring -v /etc/localtime:/etc/localtime:ro --restart always checkmk/check-mk-raw:1.6.0-latest
My code so far looks like this:
- name: Install docker on a Centos 7 machine
hosts: localhost
vars:
create_containers: 1
default_container_name: docker
default_container_image: centos
default_container_command: sleep 1d
tasks:
- name: Add Docker CE repo
get_url_
url: https://download.docker.com/linux/centos/docker-ce.repo
dest: /etc/yum.repos.d/docker-ce.repo
- name: Install Docker
yum: name=docker state=latest
- name: Start and enable the Docker daemon
service: name=docker state=started enabled=yes
- name: Install Docker Module for Python
pip:
name: docker
- name: Create a default container
docker_container:
name: "{{ default_container_name }}{{ item }}"
image: "{{ default_container_image }}"
command: "{{ default_container_command }}"
state: present
with_sequence: count={{ create_containers }}
- name: Start a container with a command
docker_container:
name: docker1
image: centos
command: ["docker container run -dit -p 8080:5000 --ulimit nofile=1024 --tmpfs /opt/omd/sites/cmk/tmp:uid=1000,gid=1000 -v monitoring:/omd/sites --name monitoring -v /etc/localtime:/etc/localtime:ro --restart always checkmk/check-mk-raw:1.6.0-latest"]
But it is throwing an error while starting my docker container:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error starting container fd44b8066dd4d205a1b2883...: 404 Client Error for http+docker://localhost/v1.26/containers fd44b8066dd4d.../start: Not found ("oci runtime error: container_linux.go:235: starting container process caused "exec: \"/bin/docker\": stat /bin/docker: no such file or directory"\n")"}
Can anyone tell me what I'm doing wrong?