Friday, May 15, 2020

Ansible In Raspberry Cluster 2nd part


The next step is build the cluster and connect, install the operations system in each SD card, conect the Raspberries to the network and energy.

The Raspberry Pi's website offers different operating systems to install in owr devices, I'm using Rasbian, a version of Debian to Rasberry Pi. the process to install it is quite easy.

First you need to download the image of operating system from the raspberry pi website, and decompress the file to get an file with extension .img

After that, you need connect the SD card to your computer using a port or an adapter. 

Many Linux distributions has pre installed an application to manage the content of the store devices called "Disks".

In this application, you have to select the SD card and, from the menu, select the option restore image. 

This option open a new window where you have to search the file with extension .img and select ti.

Once you selected the .img file, click in start an the image starts to restore the information in to the SD card.

When this process over, you have to disconnect the SD card and reconnect to the computer, this will mount the SD card in your system. In the boot partition of the SD card, you hace to create a file with the name ssh. After this, unmount all the partitions in the SD card and disconnect it form you computer.

Insert the SD card in you Raspberry Pi and turn it up.

You need to search in you ISP's router onr in the logs of your DHCP service what IP address was assigned to the Rasberry.

From a terminal, connect via ssh using the user "pi" and the IP obtained on the previous step.

To log in in to the Raspberry use the password "raspberry"

Now you are in to the Rasberry. The following steps will configure a base system. When you finish these following steps, you could generate your own image, and use it to generate the rest of the SD cards of the rest of Raspberries

Fist, using the  system tool raspi-config , change the pi password and the time zone.

Second, in the system where you will manage your cluster, create a ssh certificate using ssh-keygen and copy yo the Raspberry with ssh-copy-id (https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md)

After this, reboot you Rasberry and try to access to it using ssh. in this time, you d¿will not need a password.

If every thing is correct, the next step is turn off the Rasberry, extract the SD card and connect this one to your computer again. Using the same application "Disks", create your own .img file.

Uis this last .img file to create the rest of SD cards for the rest of your Raspberries.

Finally use the package manager in your system to instal ansible. In the case of Ubuntu/Debian use apt install ansible.

Now is time to go dirty with Ansible.


  





Sunday, May 10, 2020

Ansible In Raspberry Cluster 1st part

The intention to write this blog is document the process to create a cluster using 2 Raspberry Pi 3B  and learn the use of different DevOps tools. The first of this tools is Ansible, an orchestrator tool to manage more than one system in an easy way.

Of course, i'm writing a blog and don't write this process in a notebook, because I want to share this process with the people who have an interest on technology and this topics.

So, lets star from the beginning:

For this project I'll use:

  • 2 Raspberry Pi model 3B.
  • 2 16 GB SD cards. 
  • 3 USB Micro B cables.
  • 1 multi USB charger multi port.
  • 1 communication Switch.
  • 3 UTP Cat 5 cables.
  • 1 laptop.



The Raspberry Pies

For those who don't know this project, a Raspberry Pi is a small computer as the same size as than a credit card. To work, this computer needs an USB power supply.  like an cellphone charger, or  preferably an official Raspberry Pi power supply.

I'm going to use 2 raspberry Pi (I hoppe increase the number of raspberries in the future). The model of Raspberries that I'm going to use is 3B. Now a days for May 2020 is not the most recent model, but are the computers that I have. 

Raspberries use SD cards as "hard drive", in this case I'm going to use 16 GB SD Cards, because are the cards that I have within reach.


The communication infrastructure

My communication infrastructure consists in a cheap switch and enough UTP cables co interconnect the raspberries, the laptop and share the Internet access.

The laptop and the virtual environment

By last, I'm going to use my laptop as a command centre and to host an virtual laboratory where I can test the configurations before past them to the cluster. In this laptop I'm going to store the base image for the raspberries pies "Hard drve" to avoid configure each computer by hand 


For the next entrance, I'll write about the process to install Raspbian as the operating system for the raspberries, how to generate an image in the laptop to avoid generate this memory for each raspberries and leave reddy the cluster to work with it.

If yo have a question about this, leave a message.







A Raspberry Pi firewall: Package filter - 05 Understanding the whats and whys to manage a service

  To recap. Until now we create:  Some rules in our chains INPUT and OUTPUT to allow some traffic to specific ports A backup of our rules an...