edpm_ssh_info
This Ansible role retrieves EDPM (External Data Plane Management) SSH connectivity information.
Description
The role performs the following tasks:
Queries OpenShift for OpenStackDataPlaneNodeSet resources
Retrieves the dataplane SSH private key from OpenShift secrets (if not already present locally)
Extracts compute node names and their control plane IP addresses
Returns all information in a structured format for use in subsequent plays
Requirements
Ansible collection
kubernetes.coremust be installedAnsible collection
community.okdmust be installedValid kubeconfig file at
{{ ansible_user_dir }}/.kube/configAccess to the OpenShift/Kubernetes namespace containing EDPM resources
Appropriate permissions to read OpenStackDataPlaneNodeSet resources and secrets
Variables
Role Variables
Variable |
Default |
Description |
|---|---|---|
|
|
OpenShift namespace where EDPM resources are deployed |
|
|
Path to kubeconfig file |
|
|
Whether to authenticate to OpenShift cluster before querying resources |
|
|
OpenShift username for authentication |
|
|
Path to file containing OpenShift password |
|
|
OpenShift API URL |
|
|
Whether to validate SSL certificates when connecting to OpenShift API |
|
|
Node name prefix to filter (e.g., ‘compute-’, ‘networker-‘) |
|
|
Name of the secret containing SSH private key |
|
|
Destination path for SSH private key |
Output
Facts Set
The role sets a fact named cifmw_edpm_ssh_info with the following structure:
cifmw_edpm_ssh_info:
ssh_key_path: "/path/to/ssh/key"
nodes:
- name: compute-0
host: 192.168.122.100
- name: compute-1
host: 192.168.122.101
Fields:
ssh_key_path(string): Path to the SSH private key filenodes(list): List of discovered dataplane nodesname(string): Node name (e.g., “compute-0”)host(string): Control plane IP address
Usage
Basic Usage (with defaults)
- name: Get EDPM SSH information
hosts: localhost
gather_facts: false
tasks:
- name: Retrieve dataplane info
ansible.builtin.include_role:
name: edpm_ssh_info
- name: Display discovered nodes
ansible.builtin.debug:
msg: "Found {{ cifmw_edpm_ssh_info.nodes | length }} nodes"
Custom Configuration
- name: Get EDPM SSH information
hosts: localhost
gather_facts: false
tasks:
- name: Retrieve dataplane info
ansible.builtin.include_role:
name: edpm_ssh_info
vars:
cifmw_edpm_ssh_info_openstack_namespace: my-openstack
cifmw_edpm_ssh_info_node_prefix: networker-
cifmw_edpm_ssh_info_ssh_key_path: /custom/path/to/key
Custom Password File
- name: Get EDPM SSH information with custom password file
hosts: localhost
gather_facts: false
tasks:
- name: Retrieve dataplane info
ansible.builtin.include_role:
name: edpm_ssh_info
vars:
cifmw_edpm_ssh_info_oc_password_file: /custom/path/to/password-file
Using with Dynamic Inventory
- name: Get EDPM SSH information
hosts: localhost
gather_facts: false
tasks:
- name: Retrieve dataplane info
ansible.builtin.include_role:
name: edpm_ssh_info
- name: Add nodes to inventory
hosts: localhost
gather_facts: false
tasks:
- name: Add compute nodes to dynamic inventory
ansible.builtin.add_host:
name: "{{ item.name }}"
ansible_host: "{{ item.host }}"
ansible_ssh_private_key_file: "{{ cifmw_edpm_ssh_info.ssh_key_path }}"
groups:
- compute_nodes
loop: "{{ cifmw_edpm_ssh_info.nodes }}"
- name: Configure compute nodes
hosts: compute_nodes
tasks:
- name: Run configuration tasks
ansible.builtin.debug:
msg: "Configuring {{ inventory_hostname }}"
Notes
If your kubeconfig is already authenticated, set
cifmw_edpm_ssh_info_oc_auth_required: falseto skip theoc loginstepThe OpenShift password is read from the file specified in
cifmw_edpm_ssh_info_oc_password_file(defaults to~/.kube/kubeadmin-password)You can set a custom password file path via
cifmw_edpm_ssh_info_oc_password_fileif your password is stored elsewhereThe role will fail if no OpenStackDataPlaneNodeSet resources are found
SSH key retrieval is skipped if the key file already exists at the destination path
SSH key is saved with
0600permissions for securityThe role is idempotent - it can be run multiple times safely
Only nodes matching the specified prefix and having a control plane IP are included