Closed es1lenter closed 1 year ago
Hi Sachin and thanks for your response to my issue!
I have now tested with the example playbooks, i changed the variables in osd.yml and credentials.yml and modified the inventory file and ran the playbook from the roles/idrac_os_deployment folder with ansible-playbook -i ../inventory idractest.yml and ended up with the same tmp folder write error like in the playbook(s) i tested originally.
On Thu, 27 Jul 2023 at 11:55, Sachin Apagundi @.***> wrote:
@es1lentr https://github.com/es1lentr Thanks for reporting the bug, while we take a look at the bug, Can you please try using Role: idrac_os_deployment
https://github.com/dell/dellemc-openmanage-ansible-modules/tree/collections/roles/idrac_os_deployment example playbook and vars on how to run a role is here https://github.com/dell/dellemc-openmanage-ansible-modules/blob/collections/playbooks/roles/idrac_os_deployment/idrac_os_deployment.yml Let me know if any.
— Reply to this email directly, view it on GitHub https://github.com/dell/dellemc-openmanage-ansible-modules/issues/514#issuecomment-1653287830, or unsubscribe https://github.com/notifications/unsubscribe-auth/APWHVEVCA7X4YMB6XVTNWNTXSI3I3ANCNFSM6AAAAAA2ZWLT2U . You are receiving this because you were mentioned.Message ID: @.***>
Got it .. !!
I see that when you run without become: true
its failing when it tries to write kickstart file path to the boot file and I see that when you run with become: true
its failing when it tries to copy the generated kickstart file and it doesn't exists.
Definitely there is a permission issue when you run without become: true
from the logs.
Is it possible to attach the complete logs by running in debug mode -vvv
with become:true
, do please filter/replace the info like IP and other data as required.
Hi @sachin-apa - here's the output with become: true I'm just a bit baffled as it's just the tmp folder. Maybe when the iso is being extracted, it won't sort out the folder/file rights of the extracted folders/files and that's why it's messy.
`[myuser@myuserdev ansibleplayground]$ ansible-playbook -i /home/myuser/gitrepos/ansibleplayground/ansibleplayground/hosts idrac_osdeploy2.yml -vvv ansible-playbook [core 2.15.1] config file = /etc/ansible/ansible.cfg configured module search path = ['/home/myuser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/myuser/.local/lib/python3.9/site-packages/ansible ansible collection location = /home/myuser/.ansible/collections:/usr/share/ansible/collections executable location = /home/myuser/.local/bin/ansible-playbook python version = 3.9.16 (main, May 29 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3) jinja version = 3.1.2 libyaml = True Using /etc/ansible/ansible.cfg as config file host_list declined parsing /home/myuser/gitrepos/ansibleplayground/ansibleplayground/hosts as it did not pass its verify_file() method script declined parsing /home/myuser/gitrepos/ansibleplayground/ansibleplayground/hosts as it did not pass its verify_file() method auto declined parsing /home/myuser/gitrepos/ansibleplayground/ansibleplayground/hosts as it did not pass its verify_file() method Parsed /home/myuser/gitrepos/ansibleplayground/ansibleplayground/hosts inventory source with ini plugin Skipping callback 'default', as we already have a stdout callback. Skipping callback 'minimal', as we already have a stdout callback. Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: idrac_osdeploy2.yml **** 1 plays in idrac_osdeploy2.yml
PLAY [Generate custom iso using a kickstart file and install vSphere] ****
TASK [Gathering Facts] ***
task path: /home/myuser/gitrepos/ansibleplayground/ansibleplayground/idrac_osdeploy2.yml:1
<X.X.X.15> ESTABLISH LOCAL CONNECTION FOR USER: myuser
<X.X.X.15> EXEC /bin/sh -c 'echo ~myuser && sleep 0'
<X.X.X.15> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/myuser/.ansible/tmp
"&& mkdir "echo /home/myuser/.ansible/tmp/ansible-tmp-1690456836.561672-2958023-252538896183174
" && echo ansible-tmp-1690456836.561672-2958023-252538896183174="echo /home/myuser/.ansible/tmp/ansible-tmp-1690456836.561672-2958023-252538896183174
" ) && sleep 0'
<X.X.X.15> Attempting python interpreter discovery
<X.X.X.15> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'python3.11'"'"'; command -v '"'"'python3.10'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<X.X.X.15> EXEC /bin/sh -c '/usr/bin/python3.11 && sleep 0'
Using module file /home/myuser/.local/lib/python3.9/site-packages/ansible/modules/setup.py
<X.X.X.15> PUT /home/myuser/.ansible/tmp/ansible-local-2957961imjg4gsc/tmpzfja51xu TO /home/myuser/.ansible/tmp/ansible-tmp-1690456836.561672-2958023-252538896183174/AnsiballZ_setup.py
<X.X.X.15> EXEC /bin/sh -c 'chmod u+x /home/myuser/.ansible/tmp/ansible-tmp-1690456836.561672-2958023-252538896183174/ /home/myuser/.ansible/tmp/ansible-tmp-1690456836.561672-2958023-252538896183174/AnsiballZ_setup.py && sleep 0'
<X.X.X.15> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-jyepycdhjipaotzhsvmbthqqzwuqikyl ; /usr/bin/python3 /home/myuser/.ansible/tmp/ansible-tmp-1690456836.561672-2958023-252538896183174/AnsiballZ_setup.py'"'"' && sleep 0'
<X.X.X.15> EXEC /bin/sh -c 'rm -f -r /home/myuser/.ansible/tmp/ansible-tmp-1690456836.561672-2958023-252538896183174/ > /dev/null 2>&1 && sleep 0'
ok: [X.X.X.15]
TASK [dellemc.openmanage.idrac_os_deployment : Validating arguments against arg spec 'main' - Role to deploy operating system on the iDRAC servers] ** task path: /home/myuser/gitrepos/ansibleplayground/ansibleplayground/idrac_osdeploy2.yml:1 ok: [X.X.X.15] => { "changed": false, "msg": "The arg spec validation passed", "validate_args_context": { "argument_spec_name": "main", "name": "idrac_os_deployment", "path": "/home/myuser/.ansible/collections/ansible_collections/dellemc/openmanage/roles/idrac_os_deployment", "type": "role" } }
TASK [dellemc.openmanage.idrac_os_deployment : Validate the Inputs] ** task path: /home/myuser/.ansible/collections/ansible_collections/dellemc/openmanage/roles/idrac_os_deployment/tasks/main.yml:5 included: /home/myuser/.ansible/collections/ansible_collections/dellemc/openmanage/roles/idrac_os_deployment/tasks/common/validate_inputs.yml for X.X.X.15
TASK [dellemc.openmanage.idrac_os_deployment : Validate the OS Name and OS version is provided] ** task path: /home/myuser/.ansible/collections/ansible_collections/dellemc/openmanage/roles/idrac_os_deployment/tasks/common/validate_inputs.yml:5 skipping: [X.X.X.15] => { "changed": false, "false_condition": "os_name is undefined or os_version is undefined", "skip_reason": "Conditional result was False" }
TASK [dellemc.openmanage.idrac_os_deployment : Validate the OS Name and OS version] ** task path: /home/myuser/.ansible/collections/ansible_collections/dellemc/openmanage/roles/idrac_os_deployment/tasks/common/validate_inputs.yml:10 skipping: [X.X.X.15] => { "changed": false, "false_condition": "(os_name | upper not in idrac_os_deployment_supported_os.keys()) or ((os_version | string | split('.') | first) not in idrac_os_deployment_supported_os[os_name | upper])", "skip_reason": "Conditional result was False" }
TASK [dellemc.openmanage.idrac_os_deployment : Check if root password exists] **** task path: /home/myuser/.ansible/collections/ansible_collections/dellemc/openmanage/roles/idrac_os_deployment/tasks/common/validate_inputs.yml:16 skipping: [X.X.X.15] => { "changed": false, "false_condition": "((os_name | upper == 'RHEL') and (rhel_rootpw | length == 0)) or ((os_name | upper == 'ESXI') and (esxi_rootpw | length == 0))", "skip_reason": "Conditional result was False" }
TASK [dellemc.openmanage.idrac_os_deployment : Check if the template file exists] **** task path: /home/myuser/.ansible/collections/ansible_collections/dellemc/openmanage/roles/idrac_os_deployment/tasks/common/validate_inputs.yml:27
@es1lentr Thank You for the logs, You are right xorriso
command is extracting a files with no write permission and hence the file cannot be updated. I don't see become: true
affecting this.
Can you try the below. From your collection installation directory please update the below file and line number with a command to update the permissions of export folder.
Updated Code:
ansible.builtin.command: "{{ idrac_os_deployment_xorriso_cmd | format(idrac_os_deployment_iso_file, idrac_os_deployment_iso_extract_dir) }} | chmod -R 0744 {{ idrac_os_deployment_iso_extract_dir }}"
Please give this a try and let me know the results.
Hi @sachin-apa,
I have now modified that file in my local collection and the extract_iso.yml file looks like this:
`---
I am now getting a different error when running the playbook via the ansible-playbook -i myinventory playbook.yml -vvv command, attached as a txt file. Looks like just a syntax error?
@es1lentr Alright then lets do it in an ansible way then please add the below task to the file extract_iso.yml
and retry.
- name: Update file permissions
delegate_to: "{{ idrac_os_deployment_delegate }}"
ansible.builtin.file:
path: "{{ idrac_os_deployment_iso_extract_dir }}"
state: directory
recurse: true
mode: "0744"
Hello @sachin-apa and thank you for your swift help so far! This indeed has solved this particular issue - i tried it with and without the added code multiple times and it indeed made a difference, making the file errors gone.
I have to also add that i have now removed "become: true" from my playbook as this seemed to cause more issues than good and it is also not present in the example playbooks which could indicate it should not be used in the first place.
I have ended up with a different error this time, i am adding it here as an attachment, but if i'm not able to figure it out, i'll probably have to open another issue as this could be unrelated? I'll also try another ISO. / update - tried with the first vsphere 8.0.0 ISO, same issue.
Currently it seems to be an issue with mkisofs/genisoimage itself and i'm trying to run the command manually.
I see the command used in the collection is the same as on https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.esxi.install.doc/GUID-C03EADEA-A192-4AB4-9B71-9256A9CB1F9C.html
Will continue testing. At the moment i removed -eltorito-platform efi
from the command line and the ISO generated successfully, but i'm not so sure about it booting. I'll modify it in the local collection tomorrow and test.
I removed the mentioned line from the idrac_os_deployment_esxi_mkiso_cmd
variable and then i got another error. This time with isohybrid and i can safely assume it's because i tried removing the efi part. Just in case the log is below.
withoutefidellemc.openmanage.idrac_os_d.txt
I have changed the mkisofs to xorrisofs in line 66 in the idrac_os_deployment/vars/main.yml and it seems to run great now. I tried also with genisoimage, but it only seemed to work with xorrisofs.
Long story short - the file access change and the mkisofs command to xorrisofs (same syntax) change seemed to do the trick for me.
Bug Description
When running the playbook, everything seems to go fine until it gets to copy some files. I have tried to run it with and without become: true and am getting similar results. Both scenario logs are included.
I am still learning and this is basically the first playbook i have chopped together for playing around so please ignore that i have all the variables in the playbook, not separate.
Component or Module Name
idrac_os_deployment
Ansible Version
2.15.1
Python Version
3.9.16
iDRAC/OME/OME-M version
iDRAC 7.00.00.00
Operating System
Rocky Linux 9.2
Playbook Used
destination:
protocol: nfs hostname: X.X.Y.Y mountpoint: /home/myuser/nfss # mounted this beforehand os_type: linux iso_path: /home/nfsserver/nfs/share/ username: test password: test
Logs
With become: true
TASK [dellemc.openmanage.idrac_os_deployment : Report task failure] ************************************************************************************************************************************************************************** task path: /home/myuser/.ansible/collections/ansible_collections/dellemc/openmanage/roles/idrac_os_deployment/tasks/main.yml:65 fatal: [X.X.X.X]: FAILED! => { "failed_when_result": true, "idrac_os_deployment_failure": { "changed": false, "exception": "Traceback (most recent call last):\n File \"/home/myuser/.local/lib/python3.9/site-packages/ansible/plugins/action/copy.py\", line 466, in run\n source = self._find_needle('files', source)\n File \"/home/myuser/.local/lib/python3.9/site-packages/ansible/plugins/action/__init__.py\", line 1455, in _find_needle\n return self._loader.path_dwim_relative_stack(path_stack, dirname, needle)\n File \"/home/myuser/.local/lib/python3.9/site-packages/ansible/parsing/dataloader.py\", line 341, in path_dwim_relative_stack\n raise AnsibleFileNotFound(file_name=source, paths=[to_native(p) for p in search])\nansible.errors.AnsibleFileNotFound: Could not find or access '/tmp/omam_osdan1rzd2h/kickstart_ESXI_X.X.X.X.cfg' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option\n", "failed": true, "failed_task_name": "Copy KS file to extracted directory", "invocation": { "dest": "/tmp/omam_osdan1rzd2h/extract/KS.CFG", "mode": "0744", "module_args": { "dest": "/tmp/omam_osdan1rzd2h/extract/KS.CFG", "mode": "0744", "src": "/tmp/omam_osdan1rzd2h/kickstart_ESXI_X.X.X.X.cfg" }, "src": "/tmp/omam_osdan1rzd2h/kickstart_ESXI_X.X.X.X.cfg" }, "msg": "Could not find or access '/tmp/omam_osdan1rzd2h/kickstart_ESXI_X.X.X.X.cfg' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option" } }
Without become: true
`TASK [dellemc.openmanage.idrac_os_deployment : Append ks path to the linux boot menu] **** task path: /home/myuser/.ansible/collections/ansible_collections/dellemc/openmanage/roles/idrac_os_deployment/tasks/esxi/compile_iso.yml:9