Files
learn-traefik/1.Docker/roles/vasyakrg.docker_install/tests/role.yml
Vassiliy Yegorov edaa556a5e init commit
2020-07-08 16:03:52 +07:00

31 lines
731 B
YAML

---
- hosts: 'localhost'
roles:
- role: 'docker_install'
become: true
tasks:
- name: 'Check that the docker.pid exists'
stat:
path: /run/docker.pid
register: stat_result
failed_when: stat_result.stat.exists != true
- name: 'Result of check docker.pid'
debug:
msg: 'Docker started'
when: stat_result.stat.exists
- name: 'Pull in the latest nginx container'
become: true
docker_image:
name: 'nginx:latest'
when: stat_result.stat.exists
- name: 'Start the nginx container'
become: true
docker_container:
name: 'nginx'
image: 'nginx:latest'
state: 'started'
when: stat_result.stat.exists