vineri, 24 iunie 2016

Small Ansible introduction

When you get into something new, the learning curve, depending on the propensity of the particular context of which one is in, might be more or less steeper.

If you are like me, depending of the subject matter at hand and the particular life situation, I end up wanting to dwelve into the core of the subject matter as fast as possible or just take my time to sip slowly through and through until I have a thorough understanding.

So to get to the point of our talk. What is Ansible all about ? Ansible is a configuration management tool and language which one can use to model and configure by automating the repetitive configuration patterns.

If you want to install and configure a particular software on 10 or 20 servers one can do this with Ansible in less time than it would take to do it by hand. Multiply this with the menial daily administrative duties and one can infer the amount of time saved by automating all these tasks.

Ansible is a tool that once installed and configured properly can connect remotely through ssh to all hosts and run the configuration tasks.

Learning Ansible begins with YAML, the language into which one has to model the configuration infrastructure. With YAML one can dwelve into writing roles which in themselves are the conceptual view of a particular infrastructure. Servers, configurations, tasks are all to be found into such a role.

Yaml is a descriptive language much like Python. Spaces matter because one diferentiates separate sections through indentation. One space less you get an error, one space more and the play runs just fine. A play is essentialy a sequence of steps and a sequence of steps is essentialy a list.

Creating a role from scratch is essentialy done by running: ansible-galaxy init name_of_our_role --force.

What you get by running the above command is a directory with the proper structure of an Ansible role:

defaults (variables), files (files that you want Ansible to upload remotely), handlers (triggers that you want to run, like starting, stopping, restarting services), meta ( useful information regarding the particular role, like the dependencies with other roles), tasks ( the list of steps that you want executed), templates (Jinja configuration files that will be filled in by Ansible) and vars (variables used across the Yaml files and the Jinja configuration files).

Yaml files start with --- and end up with ... and have an .yml extension. The ones from each of the role directories which Ansible knows how to read are called main.yml

YAML works with lists and dictionaries. To get up to speed one has to understand the syntax for them.

name_of_the_list:
     - item1
     - item2

A dictionary entry is simply a pair of a name and a value. For example the name of a variable to be used inside a Jinja configuration file. Say you need to get a path to a certain location to be used inside the configuration file.

log_file_for_your_program: /var/log/your_program.log

To reference the said variable inside an YAML script or Jinja configuration file you just include it in double brackets:

{{ log_file_for_your_program }}

To get a list of variables that can be used inside YAML files and which Ansible knows how to interpret and use you can issue:

ansible -m setup ip_host -u remote_ssh_username

Once you get the role up and running you can run it on a group of hosts by defining a playbook.

The playbook is an YAML file with the following structure:

- hosts: name_of_hosts
  roles:
       - name_of_our_role

Name of our hosts can be a list of hosts in a file called the inventory:

[name_of_hosts]
ip1
ip2

Once everything is in place you can just run the playbook with the following command:

ansible-playbook -vvv -u username -i inventory_file name_of_playbook

miercuri, 22 iunie 2016

Chinese zodiac

https://www.goodreads.com/book/show/24999153-complete-guide-to-chinese-horoscopes

also please consult the post regarding Tibetan Astrology:

https://cesimplu.blogspot.com/2022/09/tibetan-astrology-astrologie-tibetana.html

https://www.travelchinaguide.com/
http://www.chinesezodiac.com

vineri, 3 iunie 2016

Connect to a wifi network with connmanctl

Easy does it:

#connmanctl
connmanctl>services
connmanctl>agent on
connmanctl>connect wifi_service_id_managed_psk
connmanctl>your_wifi_password
Connected  wifi_service_id_managed_psk
connmanctl>exit

sâmbătă, 21 mai 2016

Secure communication with PGP and Blockchain

A paper from Cornel about PGP and Blockhain:

"From Pretty Good To Great: Enhancing PGP using Bitcoin and the Blockchain"


http://arxiv.org/abs/1508.04868

My first quantum program :)

Executed on: May 21, 2016 8:12:09 AM
Results date: May 21, 2016 8:12:09 AM

Qubits

qubit 1yzx x: 0.000, y: 0.000, z: 1.000
qubit 2yzx x: 0.000, y: 0.000, z: -1.000
qubit 3yzx x: 0.000, y: 0.000, z: 1.000
qubit 4yzx x: 0.000, y: 0.000, z: 1.000

Quantum Score file

x q[0];
cx q[0], q[2];
z q[3];
t q[4];
bloch q[1];
bloch q[2];
bloch q[3];
bloch q[4];

marți, 17 mai 2016

Tanzania and Kenya black tea

If you are into black tea you probably know the Indian and Ceylon varieties which are one of the most commond on the international market, well probably except China and Japan.

Three years ago I bought my first pack of African black, the Ntingwe Kwazulu from Taylors of Harrogate. This is a strong full bodied black tea from South Africa which makes for a perfect morning cup.

Since I first tasted I wanted to try another African tea but I didn't found one on the Romanian market until a couple of weeks ago when I found two varieties. One was from Kenya and one from Tanzania.

When I bought them I didn't knew Kenya and Tanzania are neighbour countries. So the first time I bought the Kenya tea which was a round bodied black tea with a pleasant taste and strength. When I finished the Kenya tea I thought to give Tanzania a try. The rather flat smell of the tea didn't quite attracted me at first but I took one anyway. The tea failed to impress me from the taste perspective but it brought quite an interesting other.

The flat taste of the tea almost resembles water even though the colour is a quite pleasant reddish one. But when I was browsing through a National Geographic magazine I realized Masai Mara and Serengeti are part of the two neighbour countries and the end points of one of the biggest yearly migration of herbivorous on earth. The I tought that there must be a connection that explains the tastes of the two teas which are inextricably linked to the sorrounding nature. African summer and winter must be linked to this two teas. Kenya is for the summer when the herds reach the Masai Mara and Tanzania is for the winter when the herds reach the Serengeti plains.

Water boiler

Today I bought a water boiler from Tefal. More exactly model KI150. Unlike the rest of the water boilers this one has no transparent plastic window to look into to see the level of water. Instead it uses still a plastic stopper mounted inside near the pouring opening which simply states MAX. The good thing about not having a plastic window to look into which all the other models I have seen so far has is that the 100 degrees boiling water doesn't touches with the plastic while it boils which I don't think is healthy.

In fact I wasn't out to buy a water boiler but to buy an adapter plug to use for the water boiler at work, which is made for the UK network and thus incompatible with the ones in here. But the adapter I found was almost half the price of the water boiler and I wasn't even sure it would be good as it was not clear from use instructions.

So I bought the Tefal which I happen to find at the exact same shop.

luni, 16 mai 2016

Workstation

For about a year and a few months I have been using an Aspire ES1-111M as one of the main workstations.

The laptop is running happily Linux Obarun (www.obarun.org). I am using my laptop for browsing the Internet and I have to say I find it great for this purpose.

The laptop has a 11'' non glare screen, Celeron CPU, eMMC hard drive, with a comfortable keyboard, sturdy build, no flimsy parts and whisper quiet as it has no fans.

The only issue I have so far is with the touch pad which is of rather poor quality and I have intermitent issues because it just locks or freezes from time to time. The issue has been solved by attaching an external mouse.

For wireless I am using a Tenda USB adapter with RT5370 chipset which is working out of the box and can be configured with Connman which is running by default.

Obarun uses Openbox for a windows manager which is a lightweight and stable windows manager which gets the job done.

The only thing I will improve upon the laptop would be the touchpad, everything else is just spot on for my intended purpose. I feel Acer did a great job with the product and I am looking forward for the next generations of similar products which will be able to run Linux as well.

Also I very much like Obarun for being exactly what I need without much tweaking.

The few commands I found useful are:

pacman -Ssy for updating the package database
pacman -S to install packages
xbacklight -set to change the light of the screen
upower -d (after installation) to see the battery status
pppoe-setup to setup a pppoe connection
Connman for setting up wireless