{"id":18623614,"url":"https://github.com/codica2/ansible-best-practice","last_synced_at":"2025-08-11T09:10:31.552Z","repository":{"id":98303129,"uuid":"167563683","full_name":"codica2/ansible-best-practice","owner":"codica2","description":" Simple IT automation engine","archived":false,"fork":false,"pushed_at":"2019-04-12T08:33:59.000Z","size":9,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T13:11:03.652Z","etag":null,"topics":["ansible","devops-tools"],"latest_commit_sha":null,"homepage":"","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/codica2.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":"2019-01-25T14:53:37.000Z","updated_at":"2021-11-19T03:54:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"7a211d43-6aea-46cf-a96b-0417b71b6c8f","html_url":"https://github.com/codica2/ansible-best-practice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codica2/ansible-best-practice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codica2%2Fansible-best-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codica2%2Fansible-best-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codica2%2Fansible-best-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codica2%2Fansible-best-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codica2","download_url":"https://codeload.github.com/codica2/ansible-best-practice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codica2%2Fansible-best-practice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269857558,"owners_count":24486395,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","devops-tools"],"created_at":"2024-11-07T04:25:19.915Z","updated_at":"2025-08-11T09:10:31.532Z","avatar_url":"https://github.com/codica2.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eAnsible examples\u003c/h1\u003e\n\n[![](https://cdn.iconscout.com/icon/free/png-256/ansible-282283.png)](https://www.ansible.com/)\n\n**Ansible** is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.\n\n## Instalation\n### Latest Releases via Apt (Ubuntu)\n\n```sh\n$ sudo apt-get update\n$ sudo apt-get install software-properties-common\n$ sudo apt-add-repository --yes --update ppa:ansible/ansible\n$ sudo apt-get install ansible\n```\n\n### Latest Releases via Apt (Debian)\n\nDebian users may leverage the same source as the Ubuntu PPA.\n\nAdd the following line to /etc/apt/sources.list:\n\n```sh\ndeb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main\n\n```\nThen run these commands:\n\n```sh\n$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367\n$ sudo apt-get update\n$ sudo apt-get install ansible\n\n```\n[Github](https://github.com/ansible/ansible) and [Official Documentation](https://docs.ansible.com)\n\n## Hosts\n\nAnsible works against multiple systems in your infrastructure at the same time. It does this by selecting portions of systems listed in Ansible’s inventory, which defaults to being saved in the location ```/etc/ansible/hosts```. You can specify a different inventory file using the ```-i \u003cpath\u003e``` option on the command line.\n\n```\nmail.example.com\n\n[webservers]\nfoo.example.com\nbar.example.com\n\n[dbservers]\none.example.com\ntwo.example.com\nthree.example.com\n```\nThe headings in brackets are group names, which are used in classifying systems and deciding what systems you are controlling at what times and for what purpose.\n\nA YAML version would look like:\n\n```yaml\nall:\n  hosts:\n    mail.example.com:\n  children:\n    webservers:\n      hosts:\n        foo.example.com:\n        bar.example.com:\n    dbservers:\n      hosts:\n        one.example.com:\n        two.example.com:\n        three.example.com:\n```\n[Documentation](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html)\n## Modules\n\nAnsible ships with a number of modules (called the ‘module library’) that can be executed directly on remote hosts or through Playbooks.\n\nUsers can also write their own modules. These modules can control system resources, like services, packages, or files (anything really), or handle executing system commands.\n\nModules (also referred to as “task plugins” or “library plugins”) are discrete units of code that can be used from the command line or in a playbook task.\n\nLet’s review how we execute three different modules from the command line:\n\n```zh\nansible webservers -m service -a \"name=httpd state=started\"\nansible webservers -m ping\nansible webservers -m command -a \"/sbin/reboot -t now\"\n```\n\nEach module supports taking arguments. Nearly all modules take key=value arguments, space delimited. Some modules take no arguments, and the command/shell modules simply take the string of the command you want to run.\n\nFrom playbooks, Ansible modules are executed in a very similar way:\n```yml\n- name: reboot the servers\n  action: command /sbin/reboot -t now\n```\nAll modules technically return JSON format data, though if you are using the command line or playbooks, you don’t really need to know much about that. If you’re writing your own module, you care, and this means you do not have to write modules in any particular language – you get to choose.\n\n[Documentation](https://docs.ansible.com/ansible/latest/user_guide/modules_intro.html)\n\n## Playbooks\n**Playbooks** are Ansible’s configuration, deployment, and orchestration language. They can describe a policy you want your remote systems to enforce, or a set of steps in a general IT process.\n\nIf Ansible modules are the tools in your workshop, playbooks are your instruction manuals, and your inventory of hosts are your raw material.\n\nPlaybooks are expressed in YAML format (see YAML Syntax) and have a minimum of syntax, which intentionally tries to not be a programming language or script, but rather a model of a configuration or a process.\n\nEach playbook is composed of one or more ‘plays’ in a list.\n\nHere’s a playbook that contains just one play:\n\n```yml\n---\n- hosts: webservers\n  vars:\n    http_port: 80\n    max_clients: 200\n  remote_user: root\n  tasks:\n  - name: ensure apache is at the latest version\n    yum:\n      name: httpd\n      state: latest\n  - name: write the apache config file\n    template:\n      src: /srv/httpd.j2\n      dest: /etc/httpd.conf\n    notify:\n    - restart apache\n  - name: ensure apache is running\n    service:\n      name: httpd\n      state: started\n  handlers:\n    - name: restart apache\n      service:\n        name: httpd\n        state: restarted\n```\n### Executing A Playbook\n\nHow do you run a playbook? It’s simple. Let’s run a playbook using a parallelism level of 10:\n\n```zh\nansible-playbook playbook.yml -f 10\n```\n[Documentation](https://docs.ansible.com/ansible/latest/user_guide/playbooks.html)\n\n## Ansible Tower\n**Ansible Tower** helps you scale IT automation, manage complex deployments and speed productivity. Centralize and control your IT infrastructure with a visual dashboard, role-based access control, job scheduling, integrated notifications and graphical inventory management. And Ansible Tower's REST API and CLI make it easy to embed Ansible Tower into existing tools and processes.\n\nThe Ansible Tower dashboard provides a heads-up NOC-style display for everything going on in your Ansible environment.\n\nAs soon as you log in, you'll see your host and inventory status, all the recent job activity and a snapshot of recent job runs. Adjust your job status settings to graph data from specific job and time ranges.\n![](https://www.ansible.com/hs-fs/hubfs/2018_Images/Tower-Product-Screens/Tower-3-3-Dashboard-2x.png?width=598\u0026height=422\u0026name=Tower-3-3-Dashboard-2x.png)\n\n[Documentation](https://www.ansible.com/products/tower)\n## License\nCopyright © 2015-2019 Codica. It is released under the [MIT License](https://opensource.org/licenses/MIT).\n\n## About Codica\n\n[![Codica logo](https://www.codica.com/assets/images/logo/logo.svg)](https://www.codica.com)\n\nThe names and logos for Codica are trademarks of Codica.\n\nWe love open source software! See [our other projects](https://github.com/codica2) or [hire us](https://www.codica.com/) to design, develop, and grow your product.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodica2%2Fansible-best-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodica2%2Fansible-best-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodica2%2Fansible-best-practice/lists"}