GitHubContribute in GitHub: Edit online

Configuring your development workspace with Ansible

With Ansible available in your development workspace, you can run the configuration scripts that are provided in the ansible folder.

Prerequisites

If you do not have Ansible, see Configuring your development workspace manually and shell scripts for instructions on how to manually create and run some of the commands. You can review the Ansible scripts to see what interactions are scripted there.

Ensure that you have configured Ansible and installed the Red Hat Ansible Certified Content for IBM Z. For more information, see Red Hat Ansible Certified Content for IBM Z External link icon.

Configuring the connection details for your z/OS system

Edit the file ansible/inventories/inventory.yml in the repository that you cloned by replacing the ansible_host IP address with the IP address of your system. If you configured a different user than ibmuser, replace it too.

You can edit the file directly in the repository folders. Or you can copy the inventories folder to your home or etc directory. If you do that, replace the path to that location for the -i parameter in all the following command examples.

If you use IBM Wazi as a Service Development and Test VSI, edit the entry devtest1.

Note: In the following steps of this tutorial, we will use the hostname devtest1 for all commands and examples, and you need to replace it with the hostname you chose to use.

Verify that you can use Ansible by executing a ping command:

cd ansible
ansible -i inventories devtest1 -m ping

Using an Ansible playbook to initialize your local development workspace

When the command succeeds, run your first playbook with the following command:

ansible-playbook -i inventories --extra-vars "host=devtest1" initialize-local-files.yaml
  1. The command prompts you for the password and generates several files. Enter the password of the user that you specified in the previous step. The default password for IBMUSER is sys1.

  2. For the version of Zowe CLI profiles that you want to create, confirm the default value v7.

  3. For the editor that you are using, enter che if you are in Wazi for Dev Spaces.

  4. Finally, it prompts if you want to overwrite previously created files. If you modified Zowe CLI profiles in a playbook, enter yes to replace the playbook, or enter no to generate a temporary file that you can rename.

When the playbook finished executing, scroll back up and carefully review the output because it contains instructions for the following tasks to complete the setup:

  • Finish the Zowe CLI setup depending on how you answered the questions above. If you chose to not automatically overwrite, then it will provide the copy command that you need to run to do so now. For Zowe CLI v7, make sure that the playbook generated profiles for your host devtest1 and placed them for you in ~/.zowe/zowe.config.json. You must run the zowe config update-schemas command provided to complete the Zowe configuration.
  • Complete the setup of the IBM Z Open Debug launch that was created.
  • Print JSON values that you need to add to your IBM Wazi for Dev Spaces or VS Code user settings if you want to use the debugger.

Switch to Zowe Explorer to interact with z/OS:

  1. Click the Refresh icon (Refresh icon image) from the Data Sets view.

  2. Click the plus (+) icon to add the profile devtest1.rseapi that is created by the script to the view.

  3. Click the Search icon next to the new profile entry, and click Create a new filter.

  4. Enter IBMUSER or the username you use for this tutorial as the filter name to see existing data sets. Note that it might be an empty list.

  5. Right-click and create a data set such as a PDS IBMUSER.TEST. Then, you can add files, edit, and save the files.

For more information about using Zowe Explorer, see Interact with Zowe Explorer External link icon.

Using Ansible to prepare and build an application

Run the following playbook to create data sets, copy source files, and build the SAM application.

ansible-playbook -i inventories --extra-vars "host=devtest1" dbb-sam-build.yml

When you are prompted for the editor that is used for Debug, enter vscode for IBM Wazi for Dev Spaces and VS Code.

Review the playbooks and ensure that it performs the following tasks by using templates for JCL and Groovy files:

  • Executes the JCL to allocate data sets.
  • Copies program files, JCL for running and debugging, and Groovy build scripts from the local directions to z/OS UNIX and data sets.
  • Runs a build by using IBM Dependency Based Build with a Groovy build script.

Refresh the Zowe Explorer view to see the data sets and members that are created for the SAM1 and SAM2 sample COBOL applications. For example, expand the data set IBMUSER.SAMPLE.COBOL and click SAM1 to open the program in the COBOL editor of Z Open Editor.

You can find the same source for this application in the local folder COBOL. The folder COPYBOOK is also used by the script. Open SAM1.cbl in the editor and explore the Z Open Editor editing capabilities in Making COBOL and PL/I code changes External link icon with either the local or remote copy of the program.

Using Ansible to copy test data and run an application

Run the following command to upload test data and run the application:

ansible-playbook -i inventories --extra-vars "host=devtest1" dbb-sam-run.yml

After the test data is uploaded, you can run the application again from Zowe Explorer by expanding the PDS IBMUSER.SAMPLE.JCL and right-clicking the RUN JCL, and selecting Submit Job from the menu.

A notification is displayed in IBM Wazi for Dev Spaces or VS Code, and you can click to see the job inside the Zowe Explorer Jobs view. Expand the view to review the spool files that are generated by the job. IBMUSER.SAMPLE.JCL also contains a DEBUG JCL that you can use when you run a Debug session from Z Open Editor.

For more information, see Tutorial: Improve your development productivity with Ansible External link icon.