Skip to content

Commit

Permalink
fix: remove ansible collection version dependencies (#972)
Browse files Browse the repository at this point in the history
* fix: remove ansible collection dependencies. install from collections requirements directly
* fix: Control ansible host setup. Run only once.
  • Loading branch information
surajsbharadwaj authored Dec 11, 2024
1 parent 6bba2b2 commit 0957db7
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 21 deletions.
14 changes: 8 additions & 6 deletions modules/powervs-vpc-landing-zone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ module "configure_network_services" {
source = "./submodules/ansible"
depends_on = [module.vpc_file_share_alb]

bastion_host_ip = local.access_host_or_ip
ansible_host_or_ip = local.network_services_vsi_ip
ssh_private_key = var.ssh_private_key
bastion_host_ip = local.access_host_or_ip
ansible_host_or_ip = local.network_services_vsi_ip
ssh_private_key = var.ssh_private_key
configure_ansible_host = true

src_script_template_name = "configure-network-services/ansible_exec.sh.tftpl"
dst_script_file_name = "network-services-instance.sh"
Expand Down Expand Up @@ -165,9 +166,10 @@ module "configure_monitoring_host" {
depends_on = [module.configure_network_services]
count = var.enable_monitoring ? 1 : 0

bastion_host_ip = local.access_host_or_ip
ansible_host_or_ip = local.network_services_vsi_ip
ssh_private_key = var.ssh_private_key
bastion_host_ip = local.access_host_or_ip
ansible_host_or_ip = local.network_services_vsi_ip
ssh_private_key = var.ssh_private_key
configure_ansible_host = false

src_script_template_name = "configure-monitoring-instance/ansible_exec.sh.tftpl"
dst_script_file_name = "monitoring-instance.sh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ No modules.
| <a name="input_ansible_host_or_ip"></a> [ansible\_host\_or\_ip](#input\_ansible\_host\_or\_ip) | Private IP of virtual server instance running RHEL OS on which ansible will be installed and configured to act as central ansible node. | `string` | n/a | yes |
| <a name="input_ansible_vault_password"></a> [ansible\_vault\_password](#input\_ansible\_vault\_password) | Vault password to encrypt ansible variable file for SAP installation. | `string` | `null` | no |
| <a name="input_bastion_host_ip"></a> [bastion\_host\_ip](#input\_bastion\_host\_ip) | Jump/Bastion server public IP address to reach the ansible host which has private IP. | `string` | n/a | yes |
| <a name="input_configure_ansible_host"></a> [configure\_ansible\_host](#input\_configure\_ansible\_host) | If set to true, bash script will be executed to install and configure the collections and packages on ansible node. | `bool` | n/a | yes |
| <a name="input_dst_inventory_file_name"></a> [dst\_inventory\_file\_name](#input\_dst\_inventory\_file\_name) | Name for the inventory file to be generated on the Ansible host. | `string` | n/a | yes |
| <a name="input_dst_playbook_file_name"></a> [dst\_playbook\_file\_name](#input\_dst\_playbook\_file\_name) | Name for the playbook file to be generated on the Ansible host. | `string` | n/a | yes |
| <a name="input_dst_script_file_name"></a> [dst\_script\_file\_name](#input\_dst\_script\_file\_name) | Name for the bash file to be generated on the Ansible host. | `string` | n/a | yes |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
############################################################

GLOBAL_RHEL_PACKAGES="rhel-system-roles rhel-system-roles-sap expect"
GLOBAL_GALAXY_COLLECTIONS="ibm.power_linux_sap:>=3.0.0,<4.0.0 ansible.posix:1.5.4 ansible.utils:4.1.0 community.general:10.0.1"
GLOBAL_GALAXY_COLLECTIONS="ibm.power_linux_sap:>=3.0.0,<4.0.0"

############################################################
# Start functions
Expand Down Expand Up @@ -90,6 +90,7 @@ main::install_packages() {
done
done

ansible-galaxy collection install -r '/root/.ansible/collections/ansible_collections/ibm/power_linux_sap/requirements.yml' -f
main::log_info "All packages installed successfully"
fi

Expand Down
7 changes: 7 additions & 0 deletions modules/powervs-vpc-landing-zone/submodules/ansible/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ locals {
##############################################################

resource "terraform_data" "setup_ansible_host" {
count = var.configure_ansible_host ? 1 : 0

connection {
type = "ssh"
Expand Down Expand Up @@ -214,3 +215,9 @@ resource "terraform_data" "execute_playbooks_with_vault" {
]
}
}


moved {
from = terraform_data.setup_ansible_host
to = terraform_data.setup_ansible_host[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ variable "ssh_private_key" {
sensitive = true
}

variable "configure_ansible_host" {
description = "If set to true, bash script will be executed to install and configure the collections and packages on ansible node."
type = bool
}

variable "src_script_template_name" {
description = "Name of the bash script template file located within the 'templates-ansible' directory."
type = string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
copyright:
years: 2024
lastupdated: "2024-12-9"
lastupdated: "2024-12-11"
keywords:
subcollection: deployable-reference-architectures
authors:
Expand All @@ -15,7 +15,7 @@ use-case: ITServiceManagement
industry: Technology
compliance:
content-type: reference-architecture
version: v8.0.2
version: v8.0.3

---

Expand All @@ -26,7 +26,7 @@ version: v8.0.2
{: toc-industry="Technology"}
{: toc-use-case="ITServiceManagement"}
{: toc-compliance="SAPCertified"}
{: toc-version="8.0.2"}
{: toc-version="8.0.3"}

This solution helps to install the deployable architecture ['Power Virtual Server for SAP HANA'](https://cloud.ibm.com/catalog/architecture/deploy-arch-ibm-pvs-sap-9aa6135e-75d5-467e-9f4a-ac2a21c069b8-global) on top of a pre-existing Power Virtual Server(PowerVS) landscape. 'Power Virtual Server for SAP HANA' automation requires a schematics workspace id for installation. The 'Import' solution creates a schematics workspace by taking pre-existing VPC and PowerVS infrastructure resource details as inputs. The ID of this schematics workspace will be the pre-requisite workspace id required by 'Power Virtual Server for SAP HANA' to create and configure the PowerVS instances for SAP on top of the existing infrastructure.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
copyright:
years: 2024
lastupdated: "2024-12-9"
lastupdated: "2024-12-11"
keywords:
subcollection: deployable-reference-architectures
authors:
Expand All @@ -15,7 +15,7 @@ image_source: https://github.com/terraform-ibm-modules/terraform-ibm-powervs-inf
use-case: ITServiceManagement
industry: Technology
content-type: reference-architecture
version: v8.0.2
version: v8.0.3
compliance: SAPCertified

---
Expand All @@ -28,7 +28,7 @@ compliance: SAPCertified
{: toc-industry="Technology"}
{: toc-use-case="ITServiceManagement"}
{: toc-compliance="SAPCertified"}
{: toc-version="8.0.2"}
{: toc-version="8.0.3"}

The Power Virtual Server with VPC landing zone as variation 'Extend Power Virtual Server with VPC landing zone' creates an additional Power Virtual Server workspace and connects it with the already created Power Virtual Server with VPC landing zone. It builds on the existing Power Virtual Server with VPC landing zone deployed as a variation 'Create a new architecture'.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
copyright:
years: 2024
lastupdated: "2024-12-9"
lastupdated: "2024-12-11"
keywords:
subcollection: deployable-reference-architectures
authors:
Expand All @@ -15,7 +15,7 @@ image_source: https://github.com/terraform-ibm-modules/terraform-ibm-powervs-inf
use-case: ITServiceManagement
industry: Technology
content-type: reference-architecture
version: v8.0.2
version: v8.0.3
compliance:

---
Expand All @@ -28,7 +28,7 @@ compliance:
{: toc-industry="Technology"}
{: toc-use-case="ITServiceManagement"}
{: toc-compliance=""}
{: toc-version="8.0.2"}
{: toc-version="8.0.3"}

Quickstart deployment of the Power Virtual Server with VPC landing zone creates VPC services, a Power Virtual Server workspace, and interconnects them. It also deploys a Power Virtual Server of chosen T-shirt size or custom configuration. Supported Os are Aix, IBM i, and Linux images.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
copyright:
years: 2024
lastupdated: "2024-12-9"
lastupdated: "2024-12-11"
keywords:
subcollection: deployable-reference-architectures
authors:
Expand All @@ -15,7 +15,7 @@ image_source: https://github.com/terraform-ibm-modules/terraform-ibm-powervs-inf
use-case: ITServiceManagement
industry: Technology
content-type: reference-architecture
version: v8.0.2
version: v8.0.3
compliance: SAPCertified

---
Expand All @@ -28,7 +28,7 @@ compliance: SAPCertified
{: toc-industry="Technology"}
{: toc-use-case="ITServiceManagement"}
{: toc-compliance="SAPCertified"}
{: toc-version="8.0.2"}
{: toc-version="8.0.3"}

The Standard deployment of the Power Virtual Server with VPC landing zone creates VPC services and a Power Virtual Server workspace and interconnects them.

Expand Down
2 changes: 1 addition & 1 deletion solutions/standard-plus-vsi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ This example sets up the following infrastructure:

| Name | Source | Version |
|------|--------|---------|
| <a name="module_powervs_instance"></a> [powervs\_instance](#module\_powervs\_instance) | terraform-ibm-modules/powervs-instance/ibm | 2.2.1 |
| <a name="module_powervs_instance"></a> [powervs\_instance](#module\_powervs\_instance) | terraform-ibm-modules/powervs-instance/ibm | 2.2.3 |
| <a name="module_standard"></a> [standard](#module\_standard) | ../../modules/powervs-vpc-landing-zone | n/a |

### Resources
Expand Down
2 changes: 1 addition & 1 deletion solutions/standard-plus-vsi/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module "standard" {

module "powervs_instance" {
source = "terraform-ibm-modules/powervs-instance/ibm"
version = "2.2.1"
version = "2.2.3"
providers = { ibm = ibm.ibm-pi }

pi_workspace_guid = module.standard.powervs_workspace_guid
Expand Down

0 comments on commit 0957db7

Please sign in to comment.