diff --git a/content/posts/building-a-docker-swarm-with-pis.md b/content/posts/building-a-docker-swarm-with-pis.md index 72cb47b..0798b8f 100644 --- a/content/posts/building-a-docker-swarm-with-pis.md +++ b/content/posts/building-a-docker-swarm-with-pis.md @@ -145,7 +145,7 @@ self explanitory. So go ahead and assemble the cluster 🛠 file system** ### **Sort out the Network bits** -This is the easy part, there are two methods we can use to set a +This is the easy part, there are two methods you can use to set a static IP address, one is on your DHCP server and the other is on the device itself. Personally I prefer to set static IPs on the device itself so I will cover that here. @@ -153,11 +153,17 @@ device itself so I will cover that here. To find the current ip of your Pis you can go to your DHCP server and look for the DHCP leases for the Pis. +> there are naming conventions for naming primary and secondary +things but this is your cluster so be creative with it, I have my +primary node named ```Goob``` and the secondary nodes named ```Doris1``` +```Doris2``` and ```Doris3``` +[reference](https://www.youtube.com/watch?v=oFb7FVe8sdQ) + **SSH to the Pi** then open and edit the following files * /etc/hosts - * edit this line with your hostname: ```127.0.1.1 mainpi``` + * edit this line with your hostname: ```127.0.1.1 goob``` * /etc/hostname - * edit this file with your hostname: ```mainpi``` + * edit this file with your hostname: ```goob``` * /etc/dhcpcd.conf * knowing we will be using only static IPs here I delete everything in the file add the following @@ -169,4 +175,40 @@ and look for the DHCP leases for the Pis. ``` **Now reboot the pi** ```sudo shutdown -r now``` +**Once the Pis are back up log into each one and change the default +passwords** you may also want to create a new user for yourself but +thats totally optional. + +### **Provision with** ***Ansible*** +you want to **create an _Ansible_ control node** and that is as simple as +installing a package onto your machine. Ansible is built using python +which makes it easy to install as **we can use the python pip package +manger.** To check you have it installed do ```pip --version``` if +it's not installed do the following + + +```curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py``` + +```python get-pip.py --user``` + +**once you have pip installed proceed to installing _Ansible_** + +[Docs](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) + +```pip install ansible``` + +Now that ansible is installed we can create a runbok that defines the +steps ansible needs to take on the remote machine to correctly +provision it. This playbook is written in yaml so get ready to make +sure your indents are correct 😬 + +**Creating the playbook** +now you can copy what I have and it should work - after changing a +thing or two - which is fine however I encourage you to copy what I +have, read the [Docs](https://docs.ansible.com/ansible/latest/user_guide/index.html) +and make any changes you feel are necessary. + +```yaml + +```