Skip to content

shairyar/ansible-raspberry-pi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequests

Stucture

  • ansible.cfg lets ansible know the inventory file to use. The default location of inventory file is /etc/ansible/hosts.
  • 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.
  • inventory.yml contains the group of hosts.
  • Directory playbooks contains all playbooks. main.yml imports other playbook.

Commands

Check

Dry run any playbook with the --check flag for example ansible-playbook playbooks/secure.yml --check

Display inventory

ansible-inventory --list

Pinging

All hosts

ansible -m ping all -i inventory.yml or ansible -m ping all

Webservers

ansible -m ping webservers -i inventory.yml or ansible -m ping webservers

Playbook

Secure the Raspberry pi

Run 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.

ansible-playbook playbooks/secure/run.yml --ask-pass

--ask-pass will ask for a password, enter the password of a system you are SSHing into.

Dependencies

User

Create a user that will do deployment

playbooks/dependencies/user/deploy.yml

Update

To update all hosts

ansible-playbook playbooks/update/run.yml

Shutdown

To shutdown all hosts

ansible-playbook playbooks/shutdown/run.yml

ToDo

  • Find out how to manage dependencies ansible-galaxy
  • Secureing Raspberry pi
    • Add SSH key to the PI
    • Disable password based login
  • Use template
    • For setting hostnames
      • Webserver
      • Database
      • Redis
  • Implement collections
  • Shutdown specific host
  • Deployment
    • Deploy user
    • Dependencies

About

Using ansible to setup raspberry pi

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages