Open iamgini opened 2 weeks ago
Hello, @iamgini looks like you are using the old eap collection, Can you please use the latest one?
in the latest collection, we have introduced a new variable wildfly_install_download_controller_download_dir
which can probably help you in this scenario.
- name: Check local download archive path
ansible.builtin.stat:
path: "{{ wildfly_install_download_controller_download_dir | default(lookup('env', 'PWD')) }}"
register: local_path
delegate_to: localhost
Checkout the PR as well - https://github.com/ansible-middleware/wildfly/pull/216
@RanabirChakraborty oh ok. Thanks for letting me know. Actually, the customer is using an old EE and might be using the old collection inside. I will try this and update the issue.
@sabre1041 @guidograzioli do we provided our collection within an execution environment? If so, we probably need to update this one.
I can see the following check fails.
The task should check wildfly_install_download_controller_download_dir/eap_archive_filename_local
right?
- name: "Validate existing zipfiles {{ eap_archive_filename }} for offline installs"
ansible.builtin.assert:
that:
- eap_version is defined and eap_archive_filename_local is exists
quiet: True
fail_msg: "An offline install was requested, but files are not present on the controller: {{ eap_archive_filename }}"
when:
- eap_offline_install
@iamgini That really points toward the fact that the zipfile is NOT on the controller (or not at the right place).
I recall from our discussion elsewhere, that you mentioned you could NOT put the zipfile on the controller (so I suspect you put it on the target). If so, we need to change this check because the following stmt only works on the controller:
Can you simply remove this part of the code in our local testing env (just edit the file in ~/.ansible/collections/...) and test, to confirm this is the culprit?
@rpelisse correct. Yes, I removed that assert task in the collection and playbook + collection worked without any issue. (I need to test it with correct path)
The path: "{{ lookup('env', 'PWD') }}"
is giving different result for me (local using ansible-navigator
, using different EE images etc) don't know why.
There are a few things we can do.
eap_download_baseurl: https://github.com/eap/eap/releases/download
) with username password options. Assume customer's using artifactory or some servers with auth. See below sample I used in my playbook for offline installation.can remove localhost, if the download is happening directly on target server (avoid multi-hop)
- name: Download {{ eap_archive_filename }}
# no_log: true
ansible.builtin.get_url:
url: "{{ artifactory_server }}/{{ eap_archive_filename }}"
dest: "{{ eap_install_download_controller_download_dir }}/{{ eap_archive_filename }}"
username: "{{ lookup('ansible.builtin.env', 'ARTIFACTORY_ACCESS_USERNAME') | default(omit) }}"
password: "{{ lookup('ansible.builtin.env', 'ARTIFACTORY_ACCESS_PASSWORD') | default(omit) }}"
mode: '06400'
force: true
validate_certs: false
delegate_to: localhost
I will try some of those later anyway :)
About 2) : The idea is that customers would implement this kind of things (like you did) in the pre_tasks:
of the playbook, so that zipfile is in place when the collection. I don't think we should add this sort of commidity to the collection, because, in essence, we would just be wrapping ansible.builtin.get_url:
and having to deal with ALL the options (like auth) coming with it.
However, we do need to fix that the collection assumes the zipfile will be on the controller. It's better and it makes sens (avoid download the zipfile on EACH target is smoother for performance), but it should be possible for user to use zipfile already available on targets (for instance, if the zipfile is mounted from a remote file system on the target).
@rpelisse you are right; I agree on item 2.
Yeah, for offline files, maybe some logic to tell the collection that, "file is on controller" or "file is on target node already". And yes, a full/absolute path validation for "exist" check 😉
Thanks
SUMMARY
Noticed the controller and EE getting different paths when running from controller and running locally using automation controller (the dev and testing stage)
ISSUE TYPE
ANSIBLE VERSION
ansible-navigator.yml
COLLECTION VERSION
STEPS TO REPRODUCE
EXPECTED RESULTS
The
local_path.stat.path
should be consistent when we run it from the controller and ansible-navigator.ACTUAL RESULTS
The suspected task:
in
roles/eap_install/tasks/install.yml
Running from automation controller
Running local using ansible-navigatror