{"id":15416041,"url":"https://github.com/shairyar/ansible-raspberry-pi","last_synced_at":"2026-05-18T14:41:35.820Z","repository":{"id":42366139,"uuid":"405342580","full_name":"shairyar/ansible-raspberry-pi","owner":"shairyar","description":"Using ansible to setup raspberry pi","archived":false,"fork":false,"pushed_at":"2022-06-06T09:43:06.000Z","size":29,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T04:43:48.977Z","etag":null,"topics":["ansible","raspberry-pi","raspberry-pi-3"],"latest_commit_sha":null,"homepage":"","language":"Jinja","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/shairyar.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}},"created_at":"2021-09-11T09:55:13.000Z","updated_at":"2022-01-20T12:35:51.000Z","dependencies_parsed_at":"2022-09-23T20:00:34.235Z","dependency_job_id":null,"html_url":"https://github.com/shairyar/ansible-raspberry-pi","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/shairyar%2Fansible-raspberry-pi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shairyar%2Fansible-raspberry-pi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shairyar%2Fansible-raspberry-pi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shairyar%2Fansible-raspberry-pi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shairyar","download_url":"https://codeload.github.com/shairyar/ansible-raspberry-pi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245965594,"owners_count":20701702,"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","raspberry-pi","raspberry-pi-3"],"created_at":"2024-10-01T17:10:29.935Z","updated_at":"2025-10-23T07:45:17.754Z","avatar_url":"https://github.com/shairyar.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prerequests\n\n* Make sure [ansible](https://docs.ansible.com/ansible/latest/installation_guide/index.html) is installed\n\n\n# Stucture\n* `ansible.cfg` lets ansible know the inventory file to use. The [default location](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#how-to-build-your-inventory) of inventory file is `/etc/ansible/hosts`.\n* We can also let ansible know which inventory file to use by defining it inside `ansible.cfg`, this way we do not have to use the `-i` flag all the time.\n* `inventory.yml` contains the group of hosts.\n* Directory `playbooks` contains all playbooks. `main.yml` imports other playbook.\n\n\n# Commands\n\n## Check\nDry run any playbook with the `--check` flag for example `ansible-playbook playbooks/secure.yml --check`\n\n## Display inventory\n`ansible-inventory --list`\n\n## Pinging\n\n### All hosts\n`ansible -m ping all -i inventory.yml` or `ansible -m ping all`\n\n### Webservers\n\n`ansible -m ping webservers -i inventory.yml` or `ansible -m ping webservers`\n\n## Playbook\n\u003c!-- Ping hosts via playbook `ansible-playbook playbooks/main.yml` --\u003e\n\n### Secure the Raspberry pi\nRun this as the first playbook as this is meant to secure the Raspberry pi by setting up an SSH based authentication and disable the password based authentication. Once this run successfully you do not need to run this again, unless you are adding another host in inventory.\n```\nansible-playbook playbooks/secure/run.yml --ask-pass\n```\n\n`--ask-pass` will ask for a password, enter the password of a system you are SSHing into.\n\n### Dependencies\n\n#### User\nCreate a user that will do deployment\n```\nplaybooks/dependencies/user/deploy.yml\n```\n\n## Update\n\nTo update all hosts\n\n```\nansible-playbook playbooks/update/run.yml\n```\n\n## Shutdown\n\nTo shutdown all hosts\n\n```\nansible-playbook playbooks/shutdown/run.yml\n```\n\n### ToDo\n- [ ] Find out how to manage dependencies `ansible-galaxy`\n- Secureing Raspberry pi\n  - [x] Add SSH key to the PI\n  - [x] Disable password based login\n- [ ] Use template\n  - For setting hostnames\n    - [ ] Webserver\n    - [ ] Database\n    - [ ] Redis\n- [ ] Implement collections\n- [ ] Shutdown specific host\n- [ ] Deployment\n  - [x] Deploy user\n  - [ ] Dependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshairyar%2Fansible-raspberry-pi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshairyar%2Fansible-raspberry-pi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshairyar%2Fansible-raspberry-pi/lists"}