{"id":21105205,"url":"https://github.com/itwars/ansible-101","last_synced_at":"2025-05-17T09:39:32.689Z","repository":{"id":146353087,"uuid":"110727956","full_name":"itwars/ansible-101","owner":"itwars","description":"Ansible LAB with Docker","archived":false,"fork":false,"pushed_at":"2024-09-12T07:49:25.000Z","size":10,"stargazers_count":35,"open_issues_count":0,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-04T05:51:12.524Z","etag":null,"topics":["ansible","centos","debian","devops","docker","lab","ubuntu"],"latest_commit_sha":null,"homepage":"http://www.it-wars.com/posts/dev/formation-ansible-docker-devops/","language":"Shell","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/itwars.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-14T18:22:05.000Z","updated_at":"2025-01-31T18:31:27.000Z","dependencies_parsed_at":"2024-09-11T12:35:47.185Z","dependency_job_id":"de0119e3-159f-4069-9985-7151a7eb8915","html_url":"https://github.com/itwars/ansible-101","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itwars%2Fansible-101","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itwars%2Fansible-101/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itwars%2Fansible-101/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itwars%2Fansible-101/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itwars","download_url":"https://codeload.github.com/itwars/ansible-101/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254688889,"owners_count":22112513,"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","centos","debian","devops","docker","lab","ubuntu"],"created_at":"2024-11-20T00:04:18.082Z","updated_at":"2025-05-17T09:39:31.507Z","avatar_url":"https://github.com/itwars.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting starting with Ansible with a Docker LAB 🐳\n\nThis repo is part of my [blog post](http://www.it-wars.com/posts/dev/formation-ansible-docker-devops/) on geting started with Ansible and becoming a DevOps.\n\n## The LAB\n\nThe LAB is made of 3 containers to be managed by Ansible:\n\n- Docker Debian\n- Docker Ubuntu\n- Docker Alpine\n\nPlus a Docker Ansible, to have and avoid installing Ansible on your laptop.\n\n## Bootstrap Ansible LAB\n\nTo bootstrap this tutorial, I wrote and [init script](https://github.com/itwars/ansible-101/blob/master/02-init-sshkey.sh), by doing following tasks:\n\n- Delete previous 3 containers Debian, Ubuntu et Alpine\n- Create an RSA key allowing Ansible connection through SSH\n- Starting 3 instances Docker Debian, Docker Ubuntu, and Docker Alpine\n- Ssh key injection in each Docker instance using ssh-copy-id (password will be ask: toor)\n- Ansible hosts inventory creation\n\nTo \"ping\" our 3 nodes:\n\n```\ndocker run -it --rm -v `pwd`/hosts:/etc/ansible/hosts -v `pwd`/id_rsa:/root/.ssh/id_rsa ansible-cli ansible all -m ping\n```\n\nor shorter:\n\n```\n./ansible.sh ansible all -m ping \n```\n\n```\n172.17.0.3 | SUCCESS =\u003e {\n    \"changed\": false,\n    \"ping\": \"pong\"\n}\n172.17.0.4 | SUCCESS =\u003e {\n    \"changed\": false,\n    \"ping\": \"pong\"\n}\n172.17.0.2 | SUCCESS =\u003e {\n    \"changed\": false,\n    \"ping\": \"pong\"\n}\n```\n\nTo setup Nginx on Debian Ansible node:\n\n```\ndocker run -it --rm -v `pwd`/hosts:/etc/ansible/hosts -v `pwd`/id_rsa:/root/.ssh/id_rsa ansible-cli ansible debian -m apt -a \"name=nginx state=present\"\n```\n\nTo start Nginx on Debian Ansible node:\n\n```\ndocker run -it --rm -v `pwd`/hosts:/etc/ansible/hosts -v `pwd`/id_rsa:/root/.ssh/id_rsa ansible-cli ansible debian -m service -a \"name=nginx state=started\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitwars%2Fansible-101","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitwars%2Fansible-101","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitwars%2Fansible-101/lists"}