You are on page 1of 4

ANSB1 BEFORE YOU BEGIN

THE CHALLENGE

Grab an Ansible Upgrade By now, you know how the deep-down mechanics of z/OS work.
You know how to allocate a data set from Zowe, from your
terminal, through VS Code, through ZOAU… you're to the point
Save these Ansible ones for last.

To really get the most out of


where you just want things to happen as quickly and smoothly Ansible, it helps if you know
Elevate your Mainframe Experience with Ansible as possible, and we're about to play around in Ansible, a tool what's available to you
that brings it all together so you can focus on what you want to EVERYWHERE on the platform.
get done. This is next-level stuff, and you're about to get some
12 steps 2 hours hands-on experience bringing it to life on this system.

Insert Screenshot Here Insert Screenshot Here Insert Screenshot Here

1. INSTALL DOCKER IN VS CODE 2. INSTALL DOCKER DESKTOP 3. FOLLOW THE PROMPTS


Head into Extensions and look for Docker. There are lots of If this message pops up, click Install. If you missed it, or still You're going to have to use your best judgement here for a
docker-related extensions, but we're going to start out with have a warning that Docker Desktop isn't installed/running, then while. Installation should be fairly straightforward. On
just plain old "Docker". This will give VS Code the ability to head over to Docker Desktop and start the download. This is the Windows, you'll run an installer and reboot. On Mac, you'll drag
work with Docker images and containers. The install should be more complicated install, and might take up to 30 minutes Docker into Applications. A reboot may be required. After the
pretty quick, but you're not done yet. depending on your computer speed and internet connection. install finishes, launch Docker Desktop and follow the prompts.

Go into the new Docker icon that was created on the left side
and you'll notice that all of the boxes have little yellow
"warning" triangles in them, because Docker Desktop isn't
installed yet. Let's fix that in the next step.

Want to talk? Join our Slack Tweet about it!


ibm.biz/mtm_slack #MasterTheMainframe
ANSB1 Orchestrate and Automate from Anywhere

Insert Screenshot Here Insert Screenshot Here Insert Screenshot Here

4. TAKE THE TOUR (OPTIONAL) 5. LOAD UP AN IMAGE 6. RUNNING, JUST LIKE THAT
When you relaunch VS Code, click on the Docker icon on the Since we don't already have this image, it will need to
Want to play around with a sample container and try out a few download all of the pieces. When done, you'll notice that we
commands before we get started? There's a built-in demo that left side (it's that iconic whale with the containers on its back).
You should see no warning triangles, but instead something now have:
might help you get some of the Docker concepts. 1) A container
similar to the screenshot above.
2) An image
Already done, or feeling like you're pretty solid on Docker? 3) The terminal prompt is a window into the docker container
Then move along to the next step, but make sure to keep Go into your Terminal and enter this commend to run a docker
Docker Desktop running. We'll verify this in Step 5. image as a container, and give us an interactive shell within it.
This is all… a little mind-bending at first. It's acting like a virtual
docker run -it masterthemainframe/ansible:latest machine running on your computer, but it's really just the parts
needed to run Ansible.

I CAN'T GET DOCKER RUNNING. DO I NEED IT? We'll help make this a little more clear by installing one more
Docker is a technology which allows solutions that run in a standardized environment (basically, extension, catch that in the next step.
anything that runs Docker) to be picked up and made to run anywhere else. This means that every
little file, library, piece of code, even full software pacakges and operating systems can be packaged
up into a Docker Container and made available for distribution. We're making this challenge a little
bit easier by making the Ansible environment pre-packaged in a Docker Container.

If you can't get it installed, don't want to, or want to keep your options open, you can install and use
Docker on a Linux image you created in the Linux-based challenges. Or, bypass Docker altogether
and install Ansible right on most operating systems. For this guide, however, we'll follow the Docker Want to talk? Join our Slack Tweet about it!
Desktop / VS Code method, as it should work for most people. ibm.biz/mtm_slack #MasterTheMainframe
ANSB1 Orchestrate and Automate from Anywhere

Insert Screenshot Here Insert Screenshot Here Insert Screenshot Here

7. INSTALL REMOTE - CONTAINERS 8. LAUNCH REMOTE EXPLORER 9. OPEN ROOT


Head into the Extensions screen (the 4-box icon) to search and Once back in, find the new icon on the left side for Remote
install Remote - Containers. This will let us launch an entirely Explorer, and find your Ansible container in it which we just Click on the Explorer button, then click "Open Folder", and
separate VS Code window for each container we're working on. pulled down. enter "/root/" as the folder you want to open. You should wind
up with a listing of files like the one in the screenshot above.
You can skip this if you have a method you prefer, but we'll be Right-click on it and select "Attach to Container". This will
showing steps using the extension, to better illustrate the launch a new VS Code window, which gives you a view into The most relevant files you see are:
different environments. what's happening within this container image. This is the anaconda-ks.cfg – This is a "kickstart" file made by anaconda,
container view, not your computer's regular filesystem. Notice used to describe the environment.
Once done, give VS Code a restart (just to catch everything up) the green box at the bottom showing you what the view is, ansible.cfg – A configuration file for how you like Ansible to
and move to Step 8. and also that the Zowe icon is absent. run. It can also be used to set file paths, polling intervals, and
even the colors we want.
WHY ALL THE PREP WORK? ping.yml – This, along with submit-job are playbooks. These
describe the tasks we want done.
Getting a program to work once is good. Getting it to work hundreds, if not, thousands of times after
inventory > hosts – A list of systems we know about, which we
that, the exact same way, takes careful orchestration. In the past, that meant that a person, or a
can connect to.
team of people had to go and configure a whole bunch of systems, and carefully set them up so that
group_vars > mtm.yml – Information about how we want to
a program could run on them. They would manage every step of the process, and doubling the
interact with specific systems
amount of programs running meant everyone had to work twice as hard. That's the old way.

Docker containers, and orchestration that happens in solutions like Ansible and Kubernetes means
that scaling up in capability doesn't mean adding complexity at every step. It's an important
revolution in Enterprise IT that not only produces more capable solutions, but frees up staff to work Want to talk? Join our Slack Tweet about it!
on other tasks, like coming up with the next greatest thing, instead of setting up yet another system. ibm.biz/mtm_slack #MasterTheMainframe
ANSB1 Orchestrate and Automate from Anywhere

Insert Screenshot Here Insert Screenshot Here Insert Screenshot Here

10. CUSTOMIZE mtm.yml 11. THE PING OF TRUTH 12. MARK IT COMPLETE
Most of the mtm.yml file has been customized already to meet You've made it through ten steps of setup, here's the moment You can mark your challenge complete either by submitting the
the configuration of the system. Specifically, the zoau_home, you've been waiting for. CHK3 job in MTM2020.PUBLIC.JCL
python_path, and ansible_python_interpreter values. All that's
left is for you to change the user and password to match your Pull up a terminal (from within this container environment) You'll need to visit the zos_operator module page on the z/OS
login. Make those changes, save the file, and get ready to and enter the command: Core Collection reference to find the syntax for this module. Refer
finally fire off a command. ansible-playbook ping.yml to the submit_job.yml file as a reference, and feel free to borrow
the "collections" and "environment" section to get your playbook
Note that this is just the configuration for a specific system, so If all went well, you got a success message like the one working correctly, as that one is calling z/OS-specific tasks. Ping
we're not entering its IP address. That happens in the above. The pink output just mens this is the first time Ansible is a generic one that works without those parts.
inventory > hosts file. has run, and it's creating temp directories. It's all good.

NICE JOB! LET’S RECAP NEXT UP…


We're so happy we can barely contain our excitement. We took
the scenic route in getting here, and we hope you saw enough We've set it all up, we might as
along the way to inspire you to keep going. Now that we've got well use it. Proceed to ANSB2
Ansible set up on your computer (or wherever you installed it), and we'll finish with something
and have verified that we can call commands from a playbook. a little different.

You also learned that there's a difference between the core


commands built into Ansible (like Ping) and the ones you get
Want to talk? Join our Slack Tweet about it! once you start referencing the z/OS-specific ones. There's much
ibm.biz/mtm_slack #MasterTheMainframe more to see from here, let's keep moving.

You might also like