Skip to content

Commit 5d3e12c

Browse files
committed
[cifmw_setup] Fix deploy-edpm.yml crash on unpreprovisioned baremetal computes
The NFS and Ceph plays in deploy-edpm.yml target the computes group with gather_facts enabled (the default). In architecture deployments with preProvisioned=false, compute nodes are bare libvirt domains with no OS until Ironic provisions them during the kustomize_deploy stages. Ansible's implicit fact gathering tries to SSH into these unreachable hosts, aborting the entire playbook before the architecture deployment can run. Add gather_facts: false to both the NFS and Ceph plays. For the NFS play, insert an end_play guard when cifmw_architecture_scenario is defined and move fact gathering after that guard. Architecture deploys handle NFS via a post_stage hook instead (see the companion nfs-on-computes.yml hook playbook). The Ceph play already had an end_play guard but Ansible was crashing on fact gathering before reaching it. Similarly, the "Fetch network facts" task in deploy_architecture.yml delegates setup to every host in the inventory, including unprovisioned computes. Skip computes when cifmw_edpm_deploy_pre_provisioned is false. The nfs-on-computes.yml hook playbook adds a controller inventory alias so that the cifmw_nfs role's delegate_to: controller resolves correctly in the nested ansible-playbook context. This fixes all architecture-uni03gamma-deploy-bm-* jobs which have been consistently failing since the deploy-bm variant was introduced. Related-Issue: ANVIL-109 Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Roberto Alfieri <ralfieri@redhat.com>
1 parent 93e8984 commit 5d3e12c

3 files changed

Lines changed: 67 additions & 2 deletions

File tree

deploy-edpm.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,30 @@
8787

8888
- name: Deploy NFS server on target nodes
8989
become: true
90+
gather_facts: false
9091
hosts: "{{ groups[cifmw_nfs_target | default('computes')][0] | default([]) }}"
9192
tasks:
93+
- name: End play early for architecture deploys
94+
when:
95+
- cifmw_architecture_scenario is defined
96+
ansible.builtin.meta: end_play
97+
98+
- name: Gather facts for NFS deployment
99+
ansible.builtin.setup:
100+
92101
- name: Run cifmw_nfs role
93102
vars:
94103
nftables_path: /etc/nftables
95104
nftables_conf: /etc/sysconfig/nftables.conf
96105
when:
97106
- cifmw_edpm_deploy_nfs | default(false) | bool
98-
ansible.builtin.import_role:
107+
ansible.builtin.include_role:
99108
name: cifmw_nfs
100109

101110
- name: Clear ceph target hosts facts to force refreshing in HCI deployments
111+
gather_facts: false
102112
hosts: "{{ cifmw_ceph_target | default('computes') }}"
103113
tasks:
104-
# end_play will end only current play, not the main edpm-deploy.yml
105114
- name: Early end if architecture deploy
106115
when:
107116
- cifmw_architecture_scenario is defined
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
# Copyright Red Hat, Inc.
3+
# All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License. You may obtain
7+
# a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
17+
# Deploy NFS on compute nodes for architecture-based deployments.
18+
#
19+
# In architecture flows with preProvisioned=false (baremetal/Ironic),
20+
# compute nodes are not reachable until the architecture stages
21+
# provision them. The standard NFS play in deploy-edpm.yml runs
22+
# before the architecture stages, so it must be skipped. This hook
23+
# playbook is designed to run as a post_stage_run hook after the
24+
# EDPM DataPlaneDeployment completes (SSH keys authorized on computes).
25+
#
26+
# The cifmw_nfs role delegates oc commands to a host named "controller".
27+
# In the hook inventory that host may be called "controller-0" or
28+
# "localhost", so we add it explicitly.
29+
30+
- name: Ensure controller alias exists in inventory
31+
hosts: localhost
32+
gather_facts: false
33+
tasks:
34+
- name: Add controller alias pointing to localhost
35+
ansible.builtin.add_host:
36+
name: controller
37+
ansible_connection: local
38+
39+
- name: Deploy NFS on compute nodes (architecture hook)
40+
become: true
41+
hosts: "{{ groups[cifmw_nfs_target | default('computes')][0] | default([]) }}"
42+
tasks:
43+
- name: Skip if NFS deployment is not requested
44+
when:
45+
- not (cifmw_edpm_deploy_nfs | default(false) | bool)
46+
ansible.builtin.meta: end_play
47+
48+
- name: Run cifmw_nfs role
49+
vars:
50+
nftables_path: /etc/nftables
51+
nftables_conf: /etc/sysconfig/nftables.conf
52+
ansible.builtin.include_role:
53+
name: cifmw_nfs

roles/cifmw_setup/tasks/deploy_architecture.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
- always
1212
when:
1313
- "not item.startswith('ocp-')"
14+
- >-
15+
item not in groups.get('computes', []) or
16+
(cifmw_edpm_deploy_pre_provisioned | default(true) | bool)
1417
ansible.builtin.setup:
1518
gather_subset: network
1619
delegate_facts: true

0 commit comments

Comments
 (0)