{"id":26035749,"url":"https://github.com/ranjithdb/ansible-02","last_synced_at":"2025-09-10T17:34:51.298Z","repository":{"id":280972794,"uuid":"943771465","full_name":"ranjithdb/ansible-02","owner":"ranjithdb","description":"Playbooks \u0026 Package Management","archived":false,"fork":false,"pushed_at":"2025-03-06T09:23:45.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T10:24:56.563Z","etag":null,"topics":["ansible","ansible-playbook"],"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/ranjithdb.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":"2025-03-06T08:39:27.000Z","updated_at":"2025-03-06T09:25:46.000Z","dependencies_parsed_at":"2025-03-06T10:25:01.436Z","dependency_job_id":null,"html_url":"https://github.com/ranjithdb/ansible-02","commit_stats":null,"previous_names":["ranjithdb/ansible-02"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjithdb%2Fansible-02","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjithdb%2Fansible-02/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjithdb%2Fansible-02/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjithdb%2Fansible-02/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ranjithdb","download_url":"https://codeload.github.com/ranjithdb/ansible-02/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242338994,"owners_count":20111502,"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","ansible-playbook"],"created_at":"2025-03-07T05:55:08.782Z","updated_at":"2025-03-07T05:55:09.301Z","avatar_url":"https://github.com/ranjithdb.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ansible-02\n\n## Playbooks \u0026 Package Management\n\n## Overview\n\nThis project demonstrates how to use Ansible playbooks to install and manage packages. We will install and configure Nginx on our Linux Mint machines.\n\n## Prerequisites\n\n- Ansible installed on WSL (Control Node)\n- SSH key-based authentication set up between the control node and managed nodes\n- Sudo privileges on the managed nodes\n\n## Inventory Configuration\n\nEnsure your `inventory.ini` file is set up correctly:\n\n```ini\n[linux_mint]\nmint-desktop ansible_host=\u003cdesktop-ip\u003e ansible_user=\u003cuser\u003e\nmint-vm ansible_host=\u003cvm-ip\u003e ansible_user=\u003cuser\u003e\n```\n\n## Writing the Ansible Playbook\n\nCreate a file named `install_nginx.yml` with the following content:\n\n```yaml\n- name: Install and Start Nginx\n  hosts: linux_mint\n  become: true\n  tasks:\n    - name: Install Nginx\n      apt:\n        name: nginx\n        state: present\n\n    - name: Ensure Nginx is started\n      service:\n        name: nginx\n        state: started\n        enabled: true\n```\n\n### Explanation\n\n1. The playbook targets the `linux_mint` group.\n2. `become: true` ensures the tasks run with sudo privileges.\n3. The first task installs Nginx.\n4. The second task ensures Nginx is running and enabled on boot.\n\n## Running the Playbook\n\nExecute the following command:\n\n```bash\nansible-playbook -i inventory.ini install_nginx.yml --ask-become-pass\n```\n\n![ansible playbook](ss/01.png \"ansible playbook\")\n\n## Verification\n\n1.Check if Nginx is running:\n\n```bash\nansible linux_mint -i inventory.ini -m shell -a \"systemctl status nginx\"\n```\n\n2.Open a browser and visit `http://\u003cLinux_Mint_IP\u003e` to confirm the Nginx page is displayed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franjithdb%2Fansible-02","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Franjithdb%2Fansible-02","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franjithdb%2Fansible-02/lists"}