1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Ugh, looks like very few distros have the proper packages to run the docker module.

break up the tests so that we can maybe  run this on at least one
platform
This commit is contained in:
Toshio Kuratomi 2015-03-17 13:18:42 -07:00
parent a64de2e000
commit 23291e8d8c
2 changed files with 15 additions and 51 deletions

View file

@ -0,0 +1,4 @@
- name: Install docker packages (yum)
yum:
state: present
name: docker,docker-registry,python-docker-py,nmap-ncat

View file

@ -1,54 +1,14 @@
- name: Install docker packages (yum) - include: docker-setup-rht.yml
yum: when: ansible_distribution in ['Fedora']
state: present # Packages on RHEL and CentOS are broken, broken, broken. Revisit when
name: docker,docker-registry,python-docker-py # they've got that sorted out
when: ansible_distribution in ['RedHat', 'CentOS', 'Fedora'] #when: ansible_distribution in ['Fedora', 'RedHat', 'CentOS']
- name: Install docker packages (apt) # python-docker isn't available until 14.10. Revist at the next Ubuntu LTS
apt: #- include: docker-setup-debian.yml
state: present # when: ansible_distribution in ['Ubuntu']
# Note: add docker-registry when available
name: docker.io,python-docker
when: ansible_distribution in ['Ubuntu', 'Debian']
- name: Start docker daemon - include: docker-tests.yml
service: # Add other distributions as the proper packages become available
name: docker when: ansible_distribution in ['Fedora']
state: started
- name: Download busybox image
docker:
image: busybox
state: present
pull: missing
- name: Run a small script in busybox
docker:
image: busybox
state: reloaded
pull: always
command: "nc -l -p 2000 -e xargs -n1 echo hello"
detach: True
- name: Get the docker container id
shell: "docker ps | grep busybox | awk '{ print $1 }'"
register: container_id
- debug: var=container_id
- name: Get the docker container ip
shell: "docker inspect {{ container_id.stdout_lines[0] }} | grep IPAddress | awk -F '\"' '{ print $4 }'"
register: container_ip
- debug: var=container_ip
- name: Try to access the server
shell: "echo 'world' | nc {{ container_ip.stdout_lines[0] }} 2000"
register: docker_output
- debug: var=docker_output
- name: check that the script ran
assert:
that:
- "'hello world' in docker_output.stdout_lines"