Dear Customer, the Revolution Pi is based on an open source platform, which can lead to misbehavior of the devices. To solve some problems, you can use Ansible. Because Ansible is all about automation, it requires instructions to accomplish each job. With everything written down in simple script form, it's easy to do version control and automate repetitive tasks with relative ease. Regardless of whether it is a single system or many. It is available as open source software under the GNU General Public License for DevOps around the world.
Preparation
especially for Windows users
- Installing “Ubuntu on Windows” on your Windows computer. Downloadable from the Microsoft Store
- After the installation, enter the following commands on your Ubuntu Terminal:
sudo apt update sudo apt install ansible tree
- Automatic copying of the public key to the target system
Ansible automates important tasks on a target system via SSH. The SSH key of the Ansible host is located on the target system. With ssh-keygen, an SSH key is generated for your target system and entered into a repository. The repository is always different.
After we have created an SSH key, we can enter it manually in the authorised_keys file of the remote computer or use the ssh-copy-id command. We will use the ssh-copy-id command to simplify this process. Simply call the ssh-copy-id command and pass the path to the public key as follows:
ssh-copy-id -i <Location of the public key> Username@<host-ip-address
>
# Copying the SSH key with SSH-copy-id for the system of our example sudo ssh-copy-id -i /root/.ssh/id_rsa.pub pi@192.168.0.66
- Cloning the repository
We have a repository on Github where all the essential elements for solving the tasks are stored. This repository can be reached through this link https://github.com/RevolutionPi/revpi-ansible-recipes.
- Apply the instructions below to be prepared to run an Ansible script.
git clone https://github.com/RevolutionPi/revpi-ansible-recipes.git cd revpi-ansible-recipes
With the command ls -l, you can see all contents of the order revpi-ansible-recipes
- An "Inventory" must be created. In the inventory, you must enter the IP address of your target system. All devices on which the tasks are to be executed must be entered under [bet] as shown below (see the picture inventory adjustment)
First, type the following command in terminal of ubuntu on windows
sudo nano inventory
Enter the following declarations into the inventory
[target] localhost [revpi] <ip-adress of your host> remote_user=pi ansible_python_interpreter=/usr/bin/python3
- From the repository revpi-ansible-recipes/roles/network-bridge/README.md → revpi-ansible-recipes/README.md at master · RevolutionPi/revpi-ansible-recipes (github.com)) you get the Description of how to edit the Ansible script that performs your Tasks and how to configure it with the roles.
For our example, we use the role network-bridge. To see all available roles
cd roles
then
ls -l
At the moment of editing this tutorial, there is only one role in the repository: network-bridge.
Now get back to the last order revpi-ansible-recipes and editing the new ansible-script (myplaybook.yml) to perform the task for the role network-bridge.
cd .. sudo nano myplaybook.yml
- Now run the Ansible script in terminal of ubuntu on windows
ansible-playbook -i inventory -u pi myplaybook.yml
Once the script has been successfully executed, we can see the status of the execution, as shown in the following illustration: