TOM MELENDEZ: OK, so I'm playing this game.
I'm right up to the point where I'm going to take on the boss.
I've been down this road before, and I haven't succeeded.
But this time, I'm feeling really confident.
I think I can do it this.
And just at that moment, I get paged.
DYLAN SILVA: Oh, come on, really?
TOM MELENDEZ: OK, OK, OK, that was a flashback from yesterday.
[MUSIC PLAYING]
Hi, I'm Tom Melendez.
I'm a satellite operations wrangler
controlling a small fleet of satellites
taking ground images of Earth.
As part of my job, sometimes I have
to make remote software updates to these satellites or even
our ground control systems.
I also manage the software and systems
used to process our image data, along with a website that
lets you see these images.
Today, one of our satellites needed
a hotfix applied right away.
I'm going to show you how I used Ansible and Google Cloud
Platform to apply this hotfix.
Ansible is a simple-to-use and powerful IT automation engine
that handles provisioning, orchestration,
and configuration of all of your IT needs.
And here to help me explain this is Dylan.
He's a product manager at Ansible.
DYLAN SILVA: Thanks for having me here, Tom.
I'm really, really excited to see
how you're going to use Ansible to work on in a satellite.
TOM MELENDEZ: So the first part of patching
a satellite is to make sure we have a good build
and that we test it out.
We're going to use my local laptop
and Ansible to spin up a Google Compute Engine VM for this.
First, make sure you have a GCP project, the GC API is enabled,
and a service account created with
the appropriate permissions.
Be sure to download the JSON credentials file.
DYLAN SILVA: And then, obviously, you're
going to need Ansible installed on your laptop.
So we're going to have you go to ansible.com and hit
our Get Starting page to install Ansible by using
the instructions there.
TOM MELENDEZ: Since I was paged, I'm
going to get the provisioning test and push process started.
And then we'll take a look at the configuration.
I have an Ansible playbook I can use for this.
And all I need to do on my laptop is type
"ansible-playbook push-camera-parans."
And while that's working, Dylan, do
you want to walk us through the playbooks of it?
DYLAN SILVA: Yeah, sure.
So an Ansible playbook is a human-readable format
to holistically describe an environment.
In those playbooks, you have tasks that are, by default,
executed sequentially in order from top to bottom.
And those tasks call Ansible modules.
And what modules are are the tool kit in the language.
They are what extends Ansible and the simplicity
of the engine itself.
So based on what I'm reading here,
I see that you have a way for us to easily develop and test
against a satellite.
First, a GCE VM is being provisioned.
And you're also pulling in some variables
from external files, which are allowing
you to use those values without changing
the playbooks themselves.
TOM MELENDEZ: Right, Dylan.
We use that technique throughout our playbook
so they can be version-controlled, as well
as be used to build different environments.
As you see in our GCE task, we wouldn't
want to check-in our credentials into source control.
That would make the playbooks inflexible
and possibly allow for misuse.
DYLAN SILVA: And what are some of the other options
that you're specifying here for the GCE module, Tom?
TOM MELENDEZ: Well, we can specify
one of more instances that we want to be created,
as well as their zone.
We also are specifying an image, which in our case,
is a custom Debian image that includes our camera test.
DYLAN SILVA: And I also see that you have a post task
to wait for SSH to come alive before moving on
with the playbook.
That's a really good convention to go with.
TOM MELENDEZ: Let's have a look at the playbook that
runs the test, shall we?
DYLAN SILVA: Sure, I'm really anxious to see
what else you've written here.
All right, so what we have here is
tasks that is being used to test some binaries, it looks like.
You're running a command using the command module
and pulling in some variables associated to host
from various variable files.
TOM MELENDEZ: You'll see, for hosts,
we've explicitly set that value to the group name
from the previous playbook.
DYLAN SILVA: OK.
And then based on that, the nice thing
is that camera test instances can be as few or as many hosts
as you really need.
So this playbook will only run those tests against the host
that you specify.
No change is necessary.
That's pretty cool.
TOM MELENDEZ: Now, assuming the tests have passed,
we can actually push the camera configuration
to the RGS, which will then send it
to the satellite on the next pass.
DYLAN SILVA: And to do that, it looks
like you took advantage of a couple of community modules
to write out that data.
And you also have written your own custom module
that doesn't come with the Ansible
to push the data to the satellite.
TOM MELENDEZ: Correct.
Our updater code requires an NE file.
So we use the NE file module to create it
with our camera parameters.
Then we created a custom module that validates the parameters
and hands them to the binary, which submits them to the RGS,
returning to us the status and the encrypted string
for debugging.
Building the custom module was easy.
And we just placed it in the library directory,
and Ansible picked it up.
DYLAN SILVA: Cool.
TOM MELENDEZ: All right, let's go back
and step through the output from our Ansible playbook run.
DYLAN SILVA: Yeah, let's do that.
TOM MELENDEZ: You can see that it did just what we expected.
We used Ansible to spin up a GCE VM, run some tests,
deploy a hotfix to our satellite, all from my laptop.
DYLAN SILVA: Cool.
And now you can get back to that game and beat that boss.
TOM MELENDEZ: I was thinking the same thing.
Thanks for watching us today, folks.
We'll be back soon to show you a few more fun things
you can do with Ansible and Google Cloud Platform.
Thanks for joining me today, Dylan.
DYLAN SILVA: Thanks for having me, Tom.
TOM MELENDEZ: And don't forget to check out all of our Ansible
modules at the URL below.
[MUSIC PLAYING]