Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Mitarotonda committed Jul 3, 2024
2 parents 8255776 + 4155f20 commit 99a0ed4
Show file tree
Hide file tree
Showing 60 changed files with 703 additions and 240 deletions.
2 changes: 1 addition & 1 deletion collections/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ collections:
- name: ibm.ibm_zhmc
version: 1.2.1
- name: ibm.ibm_zos_cics
version: 1.1.0-beta.5
version: 2.1.0
- name: ibm.ibm_zos_core
version: 1.8.0-beta.1
- name: ibm.ibm_zos_ims
Expand Down
7 changes: 5 additions & 2 deletions z_infra_provisioning/cloud_infra_center/ocp_upi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,12 @@ Update your settings based on the samples. The following propeties are **require
| `pullsecret` | \<pull-secret\> | Get from [cloud.redhat.com](https://console.redhat.com/openshift/install/ibmz/user-provisioned) |
| `sshkey` | \<ssh-key\> | The SSH public key for the core user in RHEL CoreOS |
| `os_dns_domain` | \<external DNS ip addr\> or \<bastion ip addr\> | If you want to use your external or existing DNS server set `os_dns_domain` to use it, others set bastion machine ip address |
| `cluster_name` | \<cluster-name\> | The name of the cluster, such as `openshift`. |
| `cluster_name` | \<cluster-name\> | The name of the cluster, such as `openshift`. |
| `base_domain` | \<cluster-base-domain\> | The base domain of the cluster, the base domain is used to create routes to your OpenShift Container Platform cluster components, such as `example.com` <br/> |
| `use_internal_bastion` | true | (Boolean) true or false, if true then nodes information under /var/named/\<clustername>\.zone and /etc/haproxy/haproxy.cfg will update and remove automatically |
| `bootstrap_name_prefix` | \<bootsrap-node-name\> | The name and hostname of the bootstrap node, such as `ocp4zkboot`. If specific name is not required, leave the default value `` here. |
| `master_name_prefix` | \<master-node-name\> | The name and hostname of the master nodes, such as `ocp4zkm`. If specific name is not required, leave the default value `` here. |
| `worker_name_prefix` | \<worker-node-name\> | The name and hostname of the worker nodes, such as `ocp4zkw`. If specific name is not required, leave the default value `` here. |
| `use_internal_bastion` | true | (Boolean) true or false, if true then nodes information under /var/named/\<clustername>\.zone and /etc/haproxy/haproxy.cfg will update and remove automatically |

If you need the Ansible playbook to help configure DNS server or HAProxy server on bastion server, you need to configure correct bastion properties:

Expand Down
43 changes: 36 additions & 7 deletions z_infra_provisioning/cloud_infra_center/ocp_upi/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,43 @@
# Security groups names
os_sg_master: "{{ infra_id.stdout_lines[0] }}-master"
os_sg_worker: "{{ infra_id.stdout_lines[0] }}-worker"
# Server names
# Ignition files
os_bootstrap_ignition: "{{ infra_id.stdout_lines[0] }}-bootstrap-ignition.json"

- name: 'Bootstrap server names with prefix'
ansible.builtin.set_fact:
os_bootstrap_server_name: "{{ bootstrap_name_prefix }}"
when:
- bootstrap_name_prefix is defined

- name: 'Bootstrap server names without prefix'
ansible.builtin.set_fact:
os_bootstrap_server_name: "{{ infra_id.stdout_lines[0] }}-bootstrap"
when:
- bootstrap_name_prefix is not defined

- name: 'Master server names with prefix'
ansible.builtin.set_fact:
os_cp_server_name: "{{ master_name_prefix }}"
os_cp_server_group_name: "{{ master_name_prefix }}"
when:
- master_name_prefix is defined

- name: 'Master server names without prefix'
ansible.builtin.set_fact:
os_cp_server_name: "{{ infra_id.stdout_lines[0] }}-master"
os_cp_server_group_name: "{{ infra_id.stdout_lines[0] }}-master"
when:
- master_name_prefix is not defined

- name: 'Worker server names without prefix'
ansible.builtin.set_fact:
os_compute_server_name: "{{ infra_id.stdout_lines[0] }}-worker"
# Ignition files
os_bootstrap_ignition: "{{ infra_id.stdout_lines[0] }}-bootstrap-ignition.json"
# BFV volume names
os_bootstrap_bfv_name: "{{ infra_id.stdout_lines[0] }}-bootstrap-boot"
os_master_bfv_name: "{{ infra_id.stdout_lines[0] }}-master-boot"
os_worker_bfv_name: "{{ infra_id.stdout_lines[0] }}-worker-boot"
when:
- worker_name_prefix is not defined

- name: 'Worker server names without prefix'
ansible.builtin.set_fact:
os_compute_server_name: "{{ worker_name_prefix }}"
when:
- worker_name_prefix is defined
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,8 @@ all:
os_dns_domain: '<external-dns-ip-addr>'
cluster_name: '<cluster-name>'
base_domain: '<cluster-base-domain>'
# bootstrap_name_prefix: '<bootstrap-node-name>'
# master_name_prefix: '<master-node-name>'
# worker_name_prefix: '<worker-node-name>'
pullsecret: '<pull-secret>'
sshkey: '<ssh-key>'
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,36 @@
cmd: openstack token issue -c id -f value
register: glance_token

- name: Generate bootstrap ignition shim
ansible.builtin.script: tools/generate-bootstrap-ignitionshim.py {{ image_url.stdout_lines[0] }} {{ glance_token.stdout }} {{ infra_id.stdout_lines[0] }} {{ bootstrap_name_prefix }}
args:
executable: python3
when:
- bootstrap_name_prefix is defined

- name: Generate bootstrap ignition shim
ansible.builtin.script: tools/generate-bootstrap-ignitionshim.py {{ image_url.stdout_lines[0] }} {{ glance_token.stdout }} {{ infra_id.stdout_lines[0] }}
args:
executable: python3
when:
- bootstrap_name_prefix is not defined

- name: Generate master ignition
ansible.builtin.script: tools/generate-master-ignition.sh {{ infra_id.stdout_lines[0] }} {{ os_control_nodes_number }} {{ master_name_prefix }}
when:
- master_name_prefix is defined

- name: Generate master ignition
ansible.builtin.script: tools/generate-master-ignition.sh {{ infra_id.stdout_lines[0] }} {{ os_control_nodes_number }}
when:
- master_name_prefix is not defined

- name: Generate worker ignition
ansible.builtin.script: tools/generate-worker-ignition.sh {{ infra_id.stdout_lines[0] }} {{ os_compute_nodes_number }} {{ worker_name_prefix }}
when:
- worker_name_prefix is defined

- name: Generate worker ignition
ansible.builtin.script: tools/generate-worker-ignition.sh {{ infra_id.stdout_lines[0] }} {{ os_compute_nodes_number }}
when:
- worker_name_prefix is not defined
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,26 @@
}
})

if len(sys.argv) > 4:
name_prefix = sys.argv[4]
else:
name_prefix = ''

if name_prefix:
name_prefix_byte = name_prefix.encode()
bootstrap_hostname = base64.standard_b64encode(name_prefix_byte).decode().strip()
files.update(
{
"storage": {
"files": {
"path": "/etc/hostname",
"mode": 420,
"contents": {
"source": "data:text/plain;charset=utf-8;base64," + bootstrap_hostname
}
}
}
})
infra_id = sys.argv[3]
if infra_id:
with open(infra_id+'-bootstrap-ignition.json', 'a') as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ infra_id=$1
master_end=$(($2 - 1))

for index in $( seq 0 $master_end); do
MASTER_HOSTNAME="$infra_id-master-$index\n"
if [ -n "$3" ]; then
MASTER_HOSTNAME="$3-$index\n"
IGNITION_NAME="$3-$index"
else
MASTER_HOSTNAME="$infra_id-master-$index\n"
IGNITION_NAME="$infra_id-master-$index"
fi
python -c "import base64, json, sys
ignition = json.load(sys.stdin)
storage = ignition.get('storage', {})
files = storage.get('files', [])
files.append({'path': '/etc/hostname', 'mode': 420, 'contents': {'source': 'data:text/plain;charset=utf-8;base64,' + base64.standard_b64encode(b'$MASTER_HOSTNAME').decode().strip()},'filesystem': 'root'})
storage['files'] = files
ignition['storage'] = storage
json.dump(ignition, sys.stdout)" < master.ign > "$infra_id-master-$index-ignition.json"
json.dump(ignition, sys.stdout)" < master.ign > "$IGNITION_NAME-ignition.json"
done
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ infra_id=$1
worker_end=$(($2 - 1))

for index in $( seq 0 $worker_end); do
WORKER_HOSTNAME="$infra_id-worker-$index\n"
if [ -n "$3" ]; then
WORKER_HOSTNAME="$3-$index\n"
IGNITION_NAME="$3-$index"
else
WORKER_HOSTNAME="$infra_id-worker-$index\n"
IGNITION_NAME="$infra_id-worker-$index"
fi
python -c "import base64, json, sys
ignition = json.load(sys.stdin)
storage = ignition.get('storage', {})
files = storage.get('files', [])
files.append({'path': '/etc/hostname', 'mode': 420, 'contents': {'source': 'data:text/plain;charset=utf-8;base64,' + base64.standard_b64encode(b'$WORKER_HOSTNAME').decode().strip()},'filesystem': 'root'})
storage['files'] = files
ignition['storage'] = storage
json.dump(ignition, sys.stdout)" < worker.ign > "$infra_id-worker-$index-ignition.json"
json.dump(ignition, sys.stdout)" < worker.ign > "$IGNITION_NAME-ignition.json"
done
21 changes: 21 additions & 0 deletions zos_basics/constructs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@ configuration, flexibility is written into the samples because it can't always
be determined if a sample has access to the host’s resources. Review the
playbook for additional details and configuration.

> [!IMPORTANT]
> The release of `ibm_zos_core` collection version 1.10.0 introduced case-sensitive
> changes to modules, specifically that module choices must be lower case. See the porting
> guide in the release notes
> ([here](https://ibm.github.io/z_ansible_collections_doc/ibm_zos_core/docs/source/release_notes.html#porting-guide))
> to understand the full scope of these changes.
>
> These changes are not compatible with earlier versions of the `ibm_zos_core` collection,
> and since the earlier versions do not reach their end of life until April 2025,
> the sample playbook compatible with the older versions will remain available.
>
> To support both the latest and prior versions of the collection:
> * The `main` branch will reflect playbooks compatible with `ibm_zos_core` version 1.10.0 or later.
> * Find this playbook on the `main` branch: [here](https://github.com/IBM/z_ansible_collections_samples/tree/main/zos_basics/constructs).
> * The `ibm_zos_core-v1.9.x-samples` branch will reflect playbooks compatible with `ibm_zos_core` version 1.9.x or earlier.
> * Find this playbook on the `ibm_zos_core-v1.9.x-samples` branch: [here](https://github.com/IBM/z_ansible_collections_samples/tree/ibm_zos_core-v1.9.x-samples/zos_basics/constructs).
>
> The `ibm_zos_core-v1.9.x-samples` branch will remain available until April 2025 but will not receive updates.
>
>
## Playbook Requirements
- [IBM® z/OS® core collection 1.0.0 or later](https://galaxy.ansible.com/ibm/ibm_zos_core)
- [Ansible® 2.11 or later](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)
Expand Down
9 changes: 8 additions & 1 deletion zos_basics/constructs/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################################################################################
# Copyright (c) IBM Corporation 2021
# Copyright (c) IBM Corporation 2021, 2024
#
# All notable changes to this project will be documented in this file. Following
# releases is a decimal based date since playbooks have no version in this
Expand Down Expand Up @@ -40,3 +40,10 @@ releases:
- Added runtime-requirements.txt that lists the requirements needed for this playbook to execute
minor:
- Changed dependency from Ansible 2.10 to 2.11 to align with the collections supported Ansible
2024.04.11:
date: 2024-04-11
changes:
fixed:
- Lower case zos_job_submit module option 'location' per ibm.ibm_zos_core:1.10.0 requirements.
removed:
- Remove deprecated zos_job_submit module option 'wait'.
5 changes: 2 additions & 3 deletions zos_basics/constructs/zos_job_submit_ansible_constructs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) IBM Corporation 2021
# Copyright (c) IBM Corporation 2021, 2024
###############################################################################

###############################################################################
Expand Down Expand Up @@ -382,8 +382,7 @@
- name: Convert a local JCL file to IBM-037 and submit the job
zos_job_submit:
src: "{{playbook_dir}}/files/HELLO.jcl"
location: LOCAL
wait: false
location: local
encoding:
from: ISO8859-1
to: IBM-037
Expand Down
21 changes: 21 additions & 0 deletions zos_concepts/data_sets/copy_edit_submit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,27 @@ It is a good practice to review the playbook contents before executing
them. It will help you understand the requirements in terms of space, location,
names, authority, and the artifacts that will be created and cleaned up.

> [!IMPORTANT]
> The release of `ibm_zos_core` collection version 1.10.0 introduced case-sensitive
> changes to modules, specifically that module choices must be lower case. See the porting
> guide in the release notes
> ([here](https://ibm.github.io/z_ansible_collections_doc/ibm_zos_core/docs/source/release_notes.html#porting-guide))
> to understand the full scope of these changes.
>
> These changes are not compatible with earlier versions of the `ibm_zos_core` collection,
> and since the earlier versions do not reach their end of life until April 2025,
> the sample playbook compatible with the older versions will remain available.
>
> To support both the latest and prior versions of the collection:
> * The `main` branch will reflect playbooks compatible with `ibm_zos_core` version 1.10.0 or later.
> * Find this playbook on the `main` branch: [here](https://github.com/IBM/z_ansible_collections_samples/tree/main/zos_concepts/data_sets/copy_edit_submit).
> * The `ibm_zos_core-v1.9.x-samples` branch will reflect playbooks compatible with `ibm_zos_core` version 1.9.x or earlier.
> * Find this playbook on the `ibm_zos_core-v1.9.x-samples` branch: [here](https://github.com/IBM/z_ansible_collections_samples/tree/ibm_zos_core-v1.9.x-samples/zos_concepts/data_sets/copy_edit_submit).
>
> The `ibm_zos_core-v1.9.x-samples` branch will remain available until April 2025 but will not receive updates.
>
>
## Playbook Requirements

This playbook requires:
Expand Down
9 changes: 8 additions & 1 deletion zos_concepts/data_sets/copy_edit_submit/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################################################################################
# Copyright (c) IBM Corporation 2021
# Copyright (c) IBM Corporation 2021, 2024
#
# All notable changes to this project will be documented in this file. Following
# releases is a decimal based date since playbooks have no version in this
Expand Down Expand Up @@ -43,3 +43,10 @@ releases:
- Renamed `copy_edit_submit.yaml` to `copy_edit_submit.yml` to standardize all playbooks with the same extension
removed:
- Removed the zos_ssh connection plugin, it is no longer included in the ibm_zos_core collection.
2024.04.09:
date: 2024-04-09
changes:
fixed:
- Lower case zos_job_submit module option 'location' per ibm.ibm_zos_core:1.10.0 requirements.
removed:
- Remove deprecated zos_job_submit module option 'wait'.
Loading

0 comments on commit 99a0ed4

Please sign in to comment.