{"id":19637180,"url":"https://github.com/kenych/dockerizing-ansible","last_synced_at":"2025-07-16T04:37:45.300Z","repository":{"id":198655819,"uuid":"107561085","full_name":"kenych/dockerizing-ansible","owner":"kenych","description":"Put ansible inside docker and demo some of it's features","archived":false,"fork":false,"pushed_at":"2017-11-02T12:39:43.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T09:35:32.384Z","etag":null,"topics":["ansible","docker","sshd"],"latest_commit_sha":null,"homepage":"https://ifritltd.com/2017/10/20/running-ansible-as-docker-container/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kenych.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-10-19T14:58:34.000Z","updated_at":"2019-10-23T04:29:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"644eb372-4935-48cb-bef8-36da0db610aa","html_url":"https://github.com/kenych/dockerizing-ansible","commit_stats":null,"previous_names":["kenych/dockerizing-ansible"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kenych/dockerizing-ansible","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenych%2Fdockerizing-ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenych%2Fdockerizing-ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenych%2Fdockerizing-ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenych%2Fdockerizing-ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenych","download_url":"https://codeload.github.com/kenych/dockerizing-ansible/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenych%2Fdockerizing-ansible/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265481956,"owners_count":23773979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","docker","sshd"],"created_at":"2024-11-11T12:33:32.890Z","updated_at":"2025-07-16T04:37:45.046Z","avatar_url":"https://github.com/kenych.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Running ansible on docker.\nYou may ask why? Well, many reasons, first of all pure curiosity on how to do it, second, \nyou may end up in environment where you don't have ansible installed nor you have a \npermissions to install anything, but free to pull docker images, a sort of immutable infrastructure.\n\nYou will also learn how to dockerize an existing tool, and plus have a chance to play with ansible and ansible-playbook.\n\n```\ndocker build -f Dockerfile.ansible.cnf -t myansible .\n\ndocker build  -t my-docker-ssh .\n\ndocker run --rm -P -d  --name my-docker-ssh1  my-docker-ssh\ndocker run --rm -P -d  --name my-docker-ssh2  my-docker-ssh\n\nssh-keygen -f ansible-key\n\nssh-copy-id -f  -i ansible-key root@localhost -p $(docker port my-docker-ssh1  |grep 22 | sed 's/.*://g')\n\n\nssh -i ansible-key -p $(docker port my-docker-ssh  |grep 22 | sed 's/.*://g') 'root@localhost' ls -l /\n\ndocker run --name myansible --rm  -v `pwd`/ansible-key:/root/.ssh/id_rsa  myansible  ansible all -m raw -a \"ls /\" -i '172.17.0.2,' \n\ndocker run --name myansible --rm  -v `pwd`/ansible-key:/root/.ssh/id_rsa  myansible  ansible \\\n all -m raw -a \"ls -l /\"   -i \\\n \"$(docker inspect my-docker-ssh --format {{.NetworkSettings.Networks.bridge.IPAddress}})\",\n\n\n    \ndocker run --name myansible --rm -v `pwd`/ansible-key:/root/.ssh/id_rsa -v `pwd`/hosts:/etc/ansible/hosts  myansible  ansible docker-ssh -m raw -a \"ls -l  /\"\n\n\ndocker run --name myansible --rm -v `pwd`/ansible-key:/root/.ssh/id_rsa -v `pwd`/hosts:/etc/ansible/hosts  myansible  ansible docker-ssh -m raw -a \"apt-get install nginx -y; service nginx restart\"\n\ndocker run --name myansible --rm -v `pwd`/ansible-key:/root/.ssh/id_rsa -v `pwd`/hosts:/etc/ansible/hosts  -v `pwd`/test-playbook.yml:/tmp/test-playbook.yml  myansible  ansible-playbook -vvv /tmp/test-playbook.yml\n\n\n```\n\n\n\nhttps://ifritltd.com/2017/10/20/running-ansible-as-docker-container/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenych%2Fdockerizing-ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenych%2Fdockerizing-ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenych%2Fdockerizing-ansible/lists"}