--- - hosts: all become: true vars_files: - vars/default.yml tasks: - name: Pull default redis image docker_image: name: "{{ container_image }}" source: pull - name: Create redis container docker_container: name: "{{ container_name }}" image: "{{ container_image }}" state: started restart_policy: "unless-stopped" published_ports: - 127.0.0.1:6379:6379