Artem's ramblings

My blog about Engineering, Management, Reliability and whatever my magpie brain is focusing at the moment.

Page 2


Ansible - Bootstrap python

When you’re starting hosts from scratch, you can avoid preinstalling python in your image or startup scripts by issuing a raw command in ansible in a pre_tasks section. This doesn’t require python to be available on the remote host, effectively bootstrapping it to continue with the playbook.

Here’s an example for debian-based hosts:

- hosts: my_host
  remote_user: my_user
  become: yes
  gather_facts: false

  pre_tasks:
  - name: Bootsrap Python2 for Ansible
    raw: bash -c "test -e /usr/bin/python || (apt -qqy update && apt install -qqy python-minimal)"
    register: output
    changed_when: output.stdout != ""
  - name: Gathering Facts
    setup:  Also known as gather_facts

Note: gather_facts is set to false since some advanced facts require running python code on the remote host, hence we disable it in the beginning and then re-run it using setup:

Continue reading →


Retrieving GCE metadata map

GCE metadata can be a useful tool for getting the information about the running instance.

One needs to know exactly where to look for a particular key however. For that, the metadata actually supports a ?recursive=true parameter, returning a json of all the data available.

Observe:

 Quick helper function to pretty print JSON 
$ alias to_j="ruby -e \"require 'json';puts JSON.pretty_generate(JSON.parse(STDIN.read))\""

$ curl -s http://metadata/computeMetadata/v1/instance/?recursive=true -H "Metadata-Flavor: Google" |  to_j
{
  "attributes": {
  },
  "cpuPlatform": "Intel Broadwell",
  "description": "",
  "disks": [
    {
      "deviceName": "persistent-disk-0",
      "index": 0,
      "mode": "READ_WRITE",
      "type": "PERSISTENT-SSD"
    }
  ],
  "hostname": "vagrant-test.c.graphite-sandbox.internal",
  "id": 77747111415725975,
  "image":
...

Continue reading →


Ansible - GCP Dynamic inventory bootstrap

Ansible GCP module bootstrap

The official docs on Ansible GCP module are quite a bit confusing, so I’ve decided to publish some steps to quickly bootstrap a working environment.

Main concept is that Ansible can not only use static files as a source of inventory but also execute a script and use it’s output as an in-memory representation of it. This allows us to make dynamic inventories to load up hosts from your cloud provider, for example. And, conveniently, there’s such a script in the Ansible’s contrib directory named gce.py.

This assumes you already have:

  • Ansible installed
  • A working python installation
  • Have a service account with Compute Engine API access
  • Exported a JSON key in Credentials subsection of your console

Here are quick bootstrap instructions on how to get it working:

Install libcloud and libcrypto:

λ pip install apache-libcloud pycrypto

Create a working dir:

...

Continue reading →


What’s making me happy 08-07-2017

It’s been a while since I wrote one of those - need to keep on track.

USA trip turned out to be a success - got a ton of work done, did quite a bit of progress on my projects, met with dear friends. Nevertheless, I’m very-very happy to return back to Sydney. Missed it (and more importantly Cassie) a whole lot.

Continuing trying to figure out my allergies. Waiting for the blood panel results, new medication seems to be working a bit better *knocks on wood*. Even though there’s no substantial progress in figuring out what it is, it’s still feels good to not be standing still.

Got quite a chuckle out of Louis Rossman’s review of the Surface Laptop construction: “You have to heat gun the laptop… If they included graphics chips in there - it’s now a two-for-one repair!”

Cap your ticket backlog is an interesting article on keeping the list of work items short and some ideas how to address...

Continue reading →


What’s making me happy 18-06-2017

Visiting NorCal and Seattle area over the past 2 weeks, it’s been nice to visit some of my old friends. Those moments, although brief do warm my heart.

Took some time walking around Stanford. The Dish trail turned out to be a great walk.
19146149_10209709636086184_430125816262029059_n.jpg

Watched Hamilton in SF with my good friend Ben - it is indeed a great and very modern musical. Can highly recommend it.

Museum of Pop Culture in Seattle turned out to be a very unexpected gem. It’s a great collection of Music, Sci-Fi and other memorabilia. Their Guitar exhibition alone is worth it.

Visited Fremont Fair over the weekend - a very quirky Art fair with a nice vibe to it. Didn’t buy anything but it was nice to stroll around and take in the atmosphere.

New installment of Fire Emblem series is out with Fire Emblem: Echoes - already got a copy - can’t wait to play it!

Humble Bundle - Sekai Project is out. A bunch of great VN’s for a good...

Continue reading →


What’s making me happy 05-06-2017

Post is almost on time if you count in PST :D

Started running again for the first time in 5 months - it was only 2k and my time wasn’t the best, but it feels so good to get back in the game.

Went to Jenolan caves over the previous weekend - amazing cave system with a lot of stuff to explore in the Blue Mountains
jenolan-karst-12.jpg

Cassie introduced me to Spawn Point, which turned out to be a cosy geeky bar in central Sydney. Much alcohol-fueled Mario Kart ensued.

Holy cow, it actually happened - Utawarerumono: Mask of Deception is out in English. It’s a strange combination of a Visual Novel and a tactical RPG but the story is excellent. Playing/Watching the first one is highly recommended before starting this one.

Discovered Nidhogg - a fast-paced multiplayer fighting arcade with beautiful retro visuals and fast responsive mechanics.

Falsehoods programmers believe about time is an oldie, but I still...

Continue reading →


What’s making me happy 14-05-2017

Saw Green Day in concert this week, they really know how to put on a show, enjoyed it immensely.
IMG_0553.JPG

Took a drive out to Newcastle with Cassie, stopping by the 7-mile beach and Caves beach on our way. It was a nice day trip to get away from it all.
2017-05-12.jpg

Finished Uncharted 3 this week. Still feels more like an interactive movie than a game but the story is excellent. I’m a sucker for Indiana Jones-like mysteries.

Found a better allergy specialist to continue figuring out my allergy (or whatever it is) situation. Progress is very slow but any progress on this front makes me happy.

“Sleep deprivation is not a badge of honor” is a good writeup on why it’s bad to give up sleep by DHH. So many good quotes from the article, but I’ll pick one:
“Software development is rarely a sprint, but mostly a marathon. … trying to extract 110% performance from today when that means having only 70% performance...

Continue reading →


What’s making me happy 07-05-2017

Went hiking to Uloola Falls this weekend - was the first truly lengthy hike since my arrival in Australia, feels good to be back in the game.

Mastodon is another distributed social network which seems to be taking off a bit better than Diaspora. Interesting to see how they’ll fare in the long run.

Scalable Microservices with Kubernetes is a great course on the foundations of Kubernetes held by Kelsea Hightower, who’s a fantastic teacher in my experience.

Great keynote on Jepsen by Kyle Kingsbury. I frequent the Aphyr blog but watching Kyle’s talks is, in my opinion, much more entertaining and digestible. This is one of the more useful talks I’ve seen this year.

A great post on estimates by Dan Slimmon describing how to do more humane project management. Nothing new if you’ve been a PM for a long time and liked statistics in Uni, but I cannot say true to either of those so found it...

Continue reading →


What’s making me happy 30-04-2017

New happy post, even if a bit late :-P

Humane Development
“… sitting a butt in a chair does not magically produce work …” A good article combining some common-sense idioms about software work. I don’t agree with all points wholeheartedly but the main point is solid.

Interesting post in Wealth Simple about Anthony Bourdain, showing a bit of an insight to making money in publishing business (spoiler: it’s hard).

BirdCheese is an absolutely adorable art blog focusing mostly on birds.

Picked up BioShock Remastered as I’ve failed to play it earlier but the style looked fascinating so I decided to give it another go. Did not disappoint.

Picked up Max Frei again, this is about the 5th time I’m re-reading the entire series of books and it somehow continues to be equally entertaining.

Finally visited Taronga Zoo. First time seeing a Kangaroo live, I have to admit, even though I’ve lived in...

Continue reading →


What’s making me happy 23-04-2017

I wanted to follow Nat’s example for a while, so here we go! This is a collection of small things that made me happy this week. Hopefully those posts will provide some inspiration to others and allow me to better reflect on myself.

Paw is the most advanced API tool I’ve seen so far, it looks like a very good candidate to replace Postman in my tool belt.

What RESTful actually means - interesting article on what makes an API RESTful in practice.

I’m delighted to see that Casey Neistat’s VLOG is back. I find him very inspirational - watching his insane drive makes me want to do more with my life.

After 9 long years since the last chapter of the series, Persona 5 is finally out, can’t wait to play it!

Sword Art Online abridged came to a close with Ep.11. It’s a great parody series and one of the examples where parody (in my opinion, anyway) surpasses the original.

Continue reading →