Skip to content

fix: use workdir variable instead of ansible_env.HOME prefix#2

Open
prakhar1985 wants to merge 10 commits into
mainfrom
fix-workdir-path
Open

fix: use workdir variable instead of ansible_env.HOME prefix#2
prakhar1985 wants to merge 10 commits into
mainfrom
fix-workdir-path

Conversation

@prakhar1985

Copy link
Copy Markdown

Problem

All task files constructed the working directory path as:

{{ ansible_env.HOME }}/{{ ocp4_workload_rhoso_deployment_files_directory }}

This caused two issues:

  1. Double-slash error when an absolute path is passed as files_directory (e.g. /home/lab-user/openstack-files/root//home/lab-user/openstack-files)
  2. Deprecation warningansible_env is deprecated in favour of ansible_facts['env']

Fix

Introduce ocp4_workload_rhoso_deployment_workdir in defaults/main.yml:

ocp4_workload_rhoso_deployment_workdir: "{{ ansible_facts['env']['HOME'] }}/{{ ocp4_workload_rhoso_deployment_files_directory }}"

Replace all {{ ansible_env.HOME }}/{{ ..._files_directory }} references across 5 task files with {{ ocp4_workload_rhoso_deployment_workdir }}. Users can override workdir directly for custom paths.

Also moves nova migration key into the workdir for consistency.

Files changed

  • defaults/main.yml — add workdir variable
  • tasks/install_operators.yml — 6 occurrences fixed
  • tasks/security.yml — 2 occurrences fixed
  • tasks/network_isolation.yml — 5 occurrences fixed
  • tasks/control_plane.yml — 2 occurrences fixed
  • tasks/data_plane.yml — 4 occurrences fixed

Introduce ocp4_workload_rhoso_deployment_workdir computed from
ansible_facts env HOME to avoid double-slash when an absolute path
is used and to fix deprecation warnings. Replace all ansible_env.HOME
references across task files with the new variable.
ansible_facts['env']['HOME'] resolves to the EE container HOME (/root),
not the bastion connection user's home. Using /tmp avoids permission
issues regardless of who the SSH connection user is on the bastion.
Hardcoded delegate_to: nfs-server and delegate_to: compute01 don't match
the AgnosticD inventory which uses nfsserver and compute01 respectively.
Add configurable hostname variables with correct defaults.
…ypto dep

- handlers/main.yml: use nfs_host variable instead of hardcoded nfs-server
- remove_workload.yml: use workdir variable instead of ansible_env.HOME
- galaxy.yml: add community.crypto dependency (used by openssh_keypair in data_plane)
The EE container cannot resolve nfsserver hostname (cluster-internal DNS).
Route all nfs commands through the bastion which has cluster DNS and direct
network access to the nfsserver VM. Add nfs_ssh_user and nfs_ssh_key vars.
compute01 is also a cluster-internal VM unreachable by hostname from the EE.
Proxy all compute01 tasks through the bastion using the cluster SSH key.
…_host

AgnosticD sets ansible_host to the VM short name (e.g. nfsserver) which
resolves inside the cluster but not from the EE container. Use add_host
to resolve the IP via bastion DNS and update ansible_host + ProxyJump
so delegate_to works natively without SSH command hacks.
AgnosticD already sets public_ip_address, bastion_ssh_port and ansible_user
on isolated VM hosts. ProxyJump resolves the destination hostname from the
bastion (not the EE), so no getent needed. Just add ansible_ssh_common_args.
Remove unneeded nfs_ssh_user/key and compute_ssh_user/key variables.
AgnosticD does NOT configure SSH proxy for isolated hosts — they are
excluded from direct SSH plays (hosts: all:!isolated). We must configure
the proxy ourselves. Use ProxyCommand (not ProxyJump) so StrictHostKeyChecking=no
applies to both the bastion hop and final destination.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant