what I\'m trying to accomplish is to run commands inside of a Docker container that has already been created on a Digital Ocean Ubuntu/Docker Droplet using Ansible.
Update: there is a way to do this without using my module, see my other answer
I wrote a simple module to run exec on a remote Docker host. I've submitted it to the ansible project, but you can easily add it to your own projects if you need to. The module is only 23 lines long, take it from my pull request and add it to your ./library directory, and then you can add a task in your playbook like so:
- name: Run docker exec command
docker_exec:
command:
docker_host:
name:
register: exec_output
- name: Show exec output
debug: msg="{{ exec_output.result }}"