ansible and yum check-update

When calling yum check-update from an ansible playbook, your play may fail because check-update returns non-zero exit status for two reasons:

check-update […] returns exit value of 100 if there are packages available for an update. Also returns a list of the packages to be updated in list format. Returns 0 if no packages are available for update. Returns 1 if an error occurred.

One quick and dirty way to bypass this is to use ignore_errors: yes in your task, but this will ignore both the case of pending updates and any other kind of error and your play will continue regardless. To avoid this one can modify the play sightly to check for the exit status:

  - name: yum check-update
    shell: 'yum check-update || test $? -eq 100'

The single quotes in the shell command above do matter.

EuRuKo 2013 – a few days after

A bit more of a week has passed, so let’s put my notes in order before memory and other notes hide them away.

Euruko →
Euruko →

From the very beginning this seemed it was going to be a good conference. And why not since by entering the venue I bumped into a close friend from the 1990s whom I had not seen for a few years due to unusual circumstances.

The day began with Matz giving a keynote. And a keynote it was. It contained memories from his first Sharp computer to switching to Pascal and then to Lisp and explaining why Ruby was influenced by it. Sapir-Worf hypothesis was also included since Matz as a person who loves programming languages tried to make us all design our own domain specific language. He made the (to the point) remark that every program that we create is in fact its own programming language with which we communicate with the system and direct it to do anything we want within its abilities. Matz urged us to become language designers (remember that every interface to a program is a language) by starting with a limited domain, locate patterns, solve problems in this domain and then expand. Perfection is the enemy of the designer he said, so he also found room to squeeze the Pareto principle in his keynote, just to make sure that one is not lost in details instead of delivering a result.

Picking from the keynote and the Lisp legacy Pat Shaughnessy continued with functional aspects in Ruby and his adventures of learning Haskell in order to make a comparison and learn something new in the process. Best lines for the talk were that “memoization is just another name for caching” and that in Ruby lazy evaluation is in fact lazy enumeration and one has to keep this in mind.

Konstantin Tennhard continued with his work with Ruby and NLP. He covered a lot of aspects of NLP and how it is done and work he did with the help of JRuby and OpenNLP which I had not head of until then. He also described a gem he has built and gave examples of its usage. I guess NLP people will find this work interesting.

One of the best presentations I’ve ever watched that include Mathematics and Programming was done by Xavier Noria. How common is it that you get to hear about a proof that the square root of 2 is irrational, about the continuum hypothesis, about set theory and stuff like cardinality of a set in a Ruby talk? By his sharp remark that “programmers are so used to integers and floats that they forget the use of rationals” he went on and gave a real life example demonstrating this as an application for a betting site. Arbitrary precision and no cent lost. One pointer though. Next time that you have ZF in your slides at such a conference, translate it.

Arguably the best presentation of Euruko 2013 for me was the one by Grzegorz Witek and Simon Kroeger. They came with a real life example that Unicorn could not handle due to high load, need for many deployments per day and requirements for the fastest user experience, showed alternative plans (Puma, Reainbow, ZBattery, Thin) and why these were not follwoed thtough and how they reached to picking the commercial version of Passenger Phusion to do the job and how well it did it. A “We did it and this is how” talk where you can only admire someone with a working production setup that brings money home.

Chris Kelly walked us through parts of the source code (and macros needed to understand how Ruby works) for MRI and how garbage collection works in general and especially in Ruby 2.0. Frequent mentions to “Ruby under a microscope” were made.

Hey did you know that an ISO standard for Ruby exists? It is ISO/IEC 30170:2012 and it is a hybrid between 1.8.x. and 1.9.x. This I learned from Koichi Sasada who proved live that when you have something to say, not knowing English well is not a barrier because the audience is willing to hear.

Rubinius was the subject of Dirkjan Bussink. He explained the design behind it and that it is a good choice when number crunching is in order. Rubinius people aim for concurrency, multicore and optimization for the common case so that the programmer does not have to deal with much outside the environment of his program. He closed his presentation with a few programming mantras that are always worth mentioning like “Be nice; write type stable code”, “Write small and simple methods” and “Always benchmark your code”.

Benjamin Smith talked about rails engines and how locating patterns in the codebase and implementing them as engines helped refactoring the code for a client with a small team while the main team was working on the product. If you are into locating patterns (and you should be) when the video is put online you must watch this. As he put it “In the long term engines work out” as long as you avoid circular dependencies between engines. You can read a lot about this stuff at the rails Archives.

Many times I’ve said that Redis is the kind of software I wish I had written. So when Javier Ramirez talked about it I could not miss it. It was a general introduction for Redis to the audience and I think everyone left the room with a clear understanding of what it can and cannot do (including pubsub).

Unfortunately I missed Steve Klabnik‘s talk on Functional Reactive Ruby but from the sound of clapping it must have been a hit. I did not watch a few more presentations and the lightining talks due to other engagements and am waiting for the videos to upload so as to complete the experience.

All in all the experience of the conference was excellent, the Jazz concert great, the volunteers did a great job and in the chosen Eurovision style of presenting the conference: 12 points guys.

PS: For those interested, EuRuKo 2014 will be held in Kiev.

The Secret to Life

The Secret to Life
The Secret to Life

Feedback loops everywhere. Image source with commentary here.

Although my personal favorite secret to life remains Gene Woolsey’s:

The trick in life is to find out what you think is play that the fools think is work so that they will pay you to do it.

PS: Thanks to Roberta here is a PDF to print and hang it on your wall too.

sudo within monit

When you need to execute sudo from monit, you have to check whether the requiretty flag is off in your sudoers file.

requiretty: If set, sudo will only run when the user is logged in to a real tty. When this flag is set, sudo can only be run from a login session and not via other means such as cron(8) or cgi-bin scripts. This flag is off by default.

I was working on a machine that had:

Defaults requiretty

and got bit by that.

Κινητικότητα …

“Work expands so as to fill the time available for its completion.”Parkinson’s Law

Υπάρχει αυτή η διάχυτη αντίληψη που έχει καλλιεργηθεί εδώ και χρόνια στον κόσμο πως θα πάρουμε τους υπάλληλους που περισσεύουν από ένα τομέα και τους πάμε στον άλλο που έχει έλλειμμα (λες και παίζουμε Warcraft και μετακινούμε peons). Στην πραγματικότητα (αυτή μέσα στην οποία ζει ο διοικητής, πρόεδρος, διευθυντής, προϊστάμενος κάθε είδους) δεν υπάρχουν υπάλληλοι που να περισσεύουν. Bare with me. Αν ερωτηθούν όλοι οι προϊστάμενοι σε κάθε οργανισμό (ιδιωτικό ή δημόσιο) εάν υπάρχει προσωπικό προς διάθεση δεν υπάρχει περίπτωση ποτέ να απαντήσουν θετικά. Αντίθετα θα ζητήσουν περισσότερο προσωπικό γιατί ο όγκος δουλειάς είναι αυξανόμενος, υπάρχει έργο που μένει πίσω κ.λπ. Δεν έχει σημασία εάν μιλάμε για χρήσιμο ή άχρηστο έργο, εάν θέλουν να τους κρατάει κάποιος την τσουγκράνα ή αν σκάβουν και δεν τα βγάζουν πέρα. Όλοι θέλουν πάντα περισσότερο προσωπικό. Περίπου 6% το χρόνο:

“And this figure will invariably prove to be between 5.17 percent and 6.56 percent, irrespective of any variation in the amount of work (if any) to be done.” [pdf]

Γι’αυτό να μην περιμένουμε πολλά από την κινητικότητα. Δεν υπάρχει κανείς να δανείσει προσωπικό γιατί κανείς δεν πιστεύει πως του περισσεύει. Και ακόμα κι αν αναγκαστεί να το κάνει, επειδή έχει μάθει να δουλεύει με αυτούς που δουλεύουν αφήνοντας τους άλλους στην ησυχία τους, μαντέψτε ποιοι λίγοι θα προταθούν προς μετακίνηση.

Θα ζήσουμε πάλι μεγάλες μέρες επιχειρηματολογίας μετακινήσεων, κατά τις οποίες θα σπέρνουμε κόσμο σε όλη τη χώρα αδιακρίτως, μπορεί να δούμε και δυο τρεις επιτυχίες των δέκα ατόμων και τελικά:

Απολύσεις θα γίνουν.

– Every year you ask me to do more with less.
– And yet you somehow manage.
–CSI:NY

Resilience

“Complex systems tend to oppose their own proper function. As systems grow in complexity, they tend to oppose their stated function.”` —John Gall

Σε περίπτωση που κάποιος έχει ακόμα απορία γιατί δεν λειτουργούν οι “άχρηστοι” μεγάλοι (δημόσιοι ή όχι) οργανισμοί. Θυμάμαι δημόσιο οργανισμό του οποίου τα έσοδα πήγαιναν πρακτικά όλα στη μισθοδοσία του προσωπικού του και όχι στο έργο που έπρεπε να επιτελεί. Γιατί ανεξάρτητα από το stated purpose, η μισθοδοσία είναι η βασική λειτουργία.

Όσο γιατί δεν κλείνουν εύκολα, γίνονται δυσκίνητοι και too big to fail:

“Systems tend to grow, and as they grow, they encroach.”

Ο άνθρωπος τα έχει πει όλα.

Update:

Λέω να αναπτύξω λίγο την κοινοτυπία μου. Η αλήθεια είναι πως το συγκεκριμένο post προκλήθηκε από το πρόβλημα της ΕΡΤ και το πως το αντιμετωπίζει μια Κυβερνητική γραφειοκρατία. Δεν έχει σημασία ποιος είναι Κυβέρνηση ή όχι, ούτε πόσο μεγάλη ή μικρή ήταν η ΕΡΤ. Συνήθως λέμε κοινοτυπίες πράγματα που είναι προφανή, αλλά δεν παύουν να είναι παρατηρήσεις που ισχύουν. Στην περίπτωση μας έχουμε ένα complex system την ΕΡΤ που είναι μεγάλη και δεν δουλεύει καλά. Όχι μόνο αυτό αλλά τελικά είναι τόσο μεγάλη που με συνεχείς απεργίες σε καίριες ημερομηνίες καταφέρνει να μην υπηρετεί το σκοπό για τον οποίο υπάρχει. Δεν λέω να μην έκαναν απεργίες, εγώ ήθελα να συνεχίσει να υπάρχει η ΕΡΤ. Λέω πως αυτά φαίνονται σε ένα εξωτερικό παρατηρητή που δεν έχει καμία σχέση με τους εμπλεκόμενους στο πρόβλημα.

Όσο για το δεύτερο νόμο που αναφέρω από το Systemantics, αυτός είναι μια κλασική περιγραφή για τα legacy systems. Μπαίνουν σε λειτουργία, αποδίδουν, μεγαλώνουν σε κλίμακα και αγκιστρώνονται. Αν δεν σας αρέσει η παρατήρηση για την ΕΡΤ μπορείτε να την κάνετε για το Gmail, το twitter ή το Facebook. Αλλά τι λέω; Αυτά έχουν ωραίο web interface, δεν μπορεί να είναι τόσο χάλια όσο η ΕΡΤ.

Δεν βρίσκω κοινοτυπίες τις συγκεκριμένες φράσεις, κυρίως γιατί όταν τις χρησιμοποιώ παρατηρώ την αντίδραση στα μάτια αυτού που τις ακούει. Για έξυπνους ανθρώπους που καταλαβαίνουν από συστήματα και scaling είναι προφανείς. Αλλά δεν είναι για όλους.


† Advance gradually and in a way that causes damage.

Encouraging constructive dissent

In his “The five most important questions you will ever ask about your organization” Peter Drucker writes about how the best decision makers he has observed never make a decision if a quick consensus (among staff) is achieved. He argues that dissent drives a good decision:

Nonprofit institutions need a healthy atmosphere for dissent if they wish to foster innovation and commitment. Nonprofits must encourage honest and constructive disagreement precisely because everybody is committed to a good cause: Your opinion versus mine can easily be taken as your good faith versus mine. Without proper encouragement, people have a tendency to avoid such difficult, but vital, discussions or turn them into underground feuds.

And thus we observe one of the major deficiencies of most governments where no one dares oppose the Leader. And Leaders who are more in need of followers than opposers, do not foster dissent. This results in a convergence where the inner circle does not dare to disagree giving the Leader a distroted view of reality. Because as a basic law of Systemantics says:

Information rarely leaks up.

Always have someone question your decisions. Engineering or otherwise.

Και κάτι για τα ραδιόφωνα

Κάτι που έγραψα σχόλιο στο facebook και που αυτό το tweet με έκανε να το αντιγράψω εδώ:

“Και για να μη ξεχνιόμαστε: Θέλω πίσω την ΕΡΑ Σπορ, το Τρίτο και τον Κόσμο. Και το Α’ Πρόγραμμα για ειδήσεις. Το Β δεν μου αρέσει, αλλά φαντάζομαι υπάρχουν άνθρωποι που δεν τους αρέσει η ΕΡΑ Σπορ. Αυτό που έγινε ειδικά με τα ραδιόφωνα είναι αδιανόητο. Με τα μηνύματα (και μην ξεχνάμε πως τα Κρατικά Ραδιόφωνα ήταν τα πρώτα που δέχονταν μηνύματα στο κόστος τους και όχι στο 1 ευρώ + ΦΠΑ) και με τις γραμμές των ακροατών δημιουργήθηκαν κοινωνικά δίκτυα με βάση το παλαιότερο ηλεκτρονικό μέσο μονόδρομης επικοινωνίας. Για χρόνια άνθρωποι σαν κι εμένα κάθε βράδυ 12 με 3 άκουγαν ΕΡΑ Σπορ και μίλαγαν για την ομάδα τους, τα προβλήματα τους και τα τελευταία χρόνια και για την Κρίση. Η απόφαση και η μεθοδολογία εκτέλεσης αυτή δεν έκλεισε μόνο την “διεφθαρμένη” ΕΡΤ. Έβαλε τσιρότο και στο δικό μου στόμα. Ελιτίστικες αντιδράσεις τύπου “use Facebook instead” απλά δεν αναγνωρίζουν την αξία της φωνής και του ικανού moderator όπως ήταν οι παραγωγοί των εκπομπών αυτών.”

Το αυτό και για την επιλογή του Internet radio. Δεν είναι ubiquitous και στην τεχνοφοβική Ελλάδα δεν αφορά όλο τον κόσμο ακόμα και σίγουρα κόσμο που είναι σε κίνηση. A business case for the mobile providers?

Με την ευκαιρία να εκφράσω το σεβασμό μου στους ανθρώπους του Flash που καλύπτουν με δική τους εκπομπή τα γεγονότα. Τους “ανακάλυψα” μετά τη σιγή των FM. Είναι καιρό απλήρωτοι και δείχνουν θαυμαστή συμπαράσταση στους απολυμμένους της ΕΡΤ.