marcinbojko / proxmox-kvm-packer

Proxmox and KVM Templates - Virtual Machines using packer
Apache License 2.0
46 stars 9 forks source link

oracle 9.3 deploy #2

Closed VorlMaldor closed 7 months ago

VorlMaldor commented 7 months ago

hey, you have done amazing work here. generally speaking was easy to setup once I figured out the proxmox token part.

I did run into an issue though. Any idea where the issue might be?

==> proxmox-iso.linux: Uploading /home/packer/proxmox-kvm-packer/extra/files/cloud-init/rhel/generic/cloud.cfg => /etc/cloud/cloud.cfg proxmox-iso.linux: cloud.cfg 2.68 KiB / 2.68 KiB [======================================] 100.00% 0s ==> proxmox-iso.linux: Provisioning with shell script: /tmp/packer-shell3547237650 ==> proxmox-iso.linux: Unit /usr/lib/systemd/system/qemu-guest-agent.service is added as a dependency to a non-existent unit dev-virtio\x2dports-org.qemu.guest_agent.0.device. ==> proxmox-iso.linux: Provisioning with Ansible... proxmox-iso.linux: Setting up proxy adapter for Ansible.... ==> proxmox-iso.linux: Executing Ansible: ansible-playbook -e packer_build_name="linux" -e packer_builder_type=proxmox-iso -e packer_http_addr=192.168.1.27:8378 --ssh-extra-args '-o IdentitiesOnly=yes' -e @extra/playbooks/provision_oracle9_variables.yml -e @variables/oraclelinux9.yml -v -e ansible_ssh_private_key_file=/tmp/ansible-key1881435401 -i /tmp/packer-provisioner-ansible1614403870 /home/packer/proxmox-kvm-packer/extra/playbooks/provision_rhel.yaml proxmox-iso.linux: Using /etc/ansible/ansible.cfg as config file proxmox-iso.linux: proxmox-iso.linux: PLAY [prepare_rhel_machine] **** proxmox-iso.linux: proxmox-iso.linux: TASK [verify_ansible_meets_version_requirements] proxmox-iso.linux: ok: [default] => { proxmox-iso.linux: "changed": false, proxmox-iso.linux: "msg": "All assertions passed" proxmox-iso.linux: } proxmox-iso.linux: proxmox-iso.linux: TASK [run_initial_setup_instead_of_gather_facts] proxmox-iso.linux: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via scp: bash: line 1: /usr/lib/sftp-server: No such file or directory\nConnection closed\r\n", "unreachable": true} proxmox-iso.linux: proxmox-iso.linux: PLAY RECAP ***** proxmox-iso.linux: default : ok=1 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 proxmox-iso.linux: ==> proxmox-iso.linux: Provisioning step had errors: Running the cleanup provisioner, if present... ==> proxmox-iso.linux: Stopping VM ==> proxmox-iso.linux: Deleting VM Build 'proxmox-iso.linux' errored after 6 minutes 3 seconds: Error executing Ansible: Non-zero exit status: exit status 4

Thanks!

marcinbojko commented 7 months ago

Hi @VorlMaldor That seems to be related on your OS and ansible/packer interaction.

Try adding the following to the ansible/ansible.cfg file as noted in the README for another tested OS.:

[ssh_connection]
scp_extra_args = "-O"
VorlMaldor commented 7 months ago

I must be missing something. I don't see that anywhere in the readme in the repo. Is there another readme, or another document somewhere I should be following?

Also, is there supposed to be an ansible/ansible.cfg in this repo?

marcinbojko commented 7 months ago

No that's from Packer's. Simply (my guess) your operating system is Fedora/RHEL based, and for this ansible requires an extra option. This is OS setting https://github.com/hashicorp/packer-plugin-ansible/issues/110

VorlMaldor commented 7 months ago

sorry, I am not trying to be dense. where would I put that in your setup, or how would I add it to extra args. I am fairly new to both ansible and packer.

marcinbojko commented 7 months ago

No worries. Look for /etc/ansible/ansible.cfg and put it there


[ssh_connection]
scp_extra_args = "-O"

PS. Dense? ;)
VorlMaldor commented 7 months ago

sorry, dense is american slang for being mentally slow.

Thank you very much for all the help!

marcinbojko commented 7 months ago

Let's do something like this. I was working anyway on 'develop' branch. In about 10-15 minutes I'll push there some new changes, and this option above, as default. Please check (remember! develop branch, not main) and tell me how's it's going ;)

marcinbojko commented 7 months ago

Please try this branch: https://github.com/marcinbojko/proxmox-kvm-packer/tree/develop

VorlMaldor commented 7 months ago

ok, I tried the new branch without and with editing the ssh_connection in /etc/ansible/ansible.cfg and received the same errors. if you need the whole log let me know. proxmox-iso.linux: proxmox-iso.linux: TASK [initial_clean] * proxmox-iso.linux: ok: [default] => { proxmox-iso.linux: "msg": "Starting provision" proxmox-iso.linux: } proxmox-iso.linux: proxmox-iso.linux: TASK [install_initial_packages] **** proxmox-iso.linux: FAILED - RETRYING: [default]: install_initial_packages (2 retries left). proxmox-iso.linux: FAILED - RETRYING: [default]: install_initial_packages (1 retries left). proxmox-iso.linux: failed: [default] (item=oracle-release-el9) => {"ansible_loop_var": "item", "attempts": 2, "changed": false, "failures": ["No package oracle-release-el9 available."], "item": "oracle-release-el9", "msg": "Failed to install some of the specified packages", "rc": 1, "results": []} proxmox-iso.linux: changed: [default] => (item=curl) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": "curl", "msg": "", "rc": 0, "results": ["Installed: curl-7.76.1-26.el9_3.3.x86_64", "Installed: libcurl-7.76.1-26.el9_3.3.x86_64", "Removed: libcurl-7.76.1-26.el9.x86_64", "Removed: curl-7.76.1-26.el9.x86_64"]} proxmox-iso.linux: ok: [default] => (item=mc) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "mc", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: ok: [default] => (item=wget) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "wget", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: ok: [default] => (item=tar) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "tar", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: ok: [default] => (item=bzip2) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "bzip2", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: changed: [default] => (item=kernel-devel) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": "kernel-devel", "msg": "", "rc": 0, "results": ["Installed: kernel-devel-5.14.0-362.18.1.el9_3.x86_64"]} proxmox-iso.linux: changed: [default] => (item=kernel-headers) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": "kernel-headers", "msg": "", "rc": 0, "results": ["Installed: kernel-headers-5.14.0-362.18.1.el9_3.x86_64", "Removed: kernel-headers-5.14.0-362.8.1.el9_3.x86_64"]} proxmox-iso.linux: ok: [default] => (item=perl) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "perl", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: ok: [default] => (item=gcc) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "gcc", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: ok: [default] => (item=make) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "make", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: ok: [default] => (item=elfutils-libelf-devel) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "elfutils-libelf-devel", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: ok: [default] => (item=langpacks-en) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "langpacks-en", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: changed: [default] => (item=glibc-all-langpacks) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": "glibc-all-langpacks", "msg": "", "rc": 0, "results": ["Installed: glibc-2.34-83.0.2.el9_3.7.x86_64", "Installed: glibc-devel-2.34-83.0.2.el9_3.7.x86_64", "Installed: glibc-gconv-extra-2.34-83.0.2.el9_3.7.x86_64", "Installed: glibc-all-langpacks-2.34-83.0.2.el9_3.7.x86_64", "Installed: glibc-common-2.34-83.0.2.el9_3.7.x86_64", "Installed: glibc-langpack-en-2.34-83.0.2.el9_3.7.x86_64", "Installed: glibc-headers-2.34-83.0.2.el9_3.7.x86_64", "Removed: glibc-2.34-83.0.1.el9_3.7.x86_64", "Removed: glibc-all-langpacks-2.34-83.0.1.el9_3.7.x86_64", "Removed: glibc-common-2.34-83.0.1.el9_3.7.x86_64", "Removed: glibc-devel-2.34-83.0.1.el9_3.7.x86_64", "Removed: glibc-gconv-extra-2.34-83.0.1.el9_3.7.x86_64", "Removed: glibc-headers-2.34-83.0.1.el9_3.7.x86_64", "Removed: glibc-langpack-en-2.34-83.0.1.el9_3.7.x86_64"]} proxmox-iso.linux: ok: [default] => (item=ca-certificates) => {"ansible_loop_var": "item", "attempts": 1, "changed": false, "item": "ca-certificates", "msg": "Nothing to do", "rc": 0, "results": []} proxmox-iso.linux: changed: [default] => (item=yum-utils) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": "yum-utils", "msg": "", "rc": 0, "results": ["Installed: yum-utils-4.3.0-11.0.1.el9_3.noarch"]} proxmox-iso.linux: changed: [default] => (item=sendmail) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": "sendmail", "msg": "", "rc": 0, "results": ["Installed: sendmail-8.16.1-11.0.1.el9.x86_64", "Installed: procmail-3.22-56.el9.x86_64", "Installed: tinycdb-0.78-18.el9.x86_64", "Installed: cyrus-sasl-2.1.27-21.el9.x86_64"]} proxmox-iso.linux: changed: [default] => (item=cockpit-pcp) => {"ansible_loop_var": "item", "attempts": 1, "changed": true, "item": "cockpit-pcp", "msg": "", "rc": 0, "results": ["Installed: libuv-1:1.42.0-1.el9.x86_64", "Installed: pcp-conf-6.0.5-4.0.1.el9.x86_64", "Installed: pcp-libs-6.0.5-4.0.1.el9.x86_64", "Installed: libatomic-11.4.1-2.1.0.1.el9.x86_64", "Installed: libproxy-webkitgtk4-0.4.15-35.el9.x86_64", "Installed: pcp-selinux-6.0.5-4.0.1.el9.x86_64", "Installed: webkit2gtk3-jsc-2.40.5-1.el9_3.1.x86_64", "Installed: json-glib-1.6.6-1.el9.x86_64", "Installed: abattis-cantarell-fonts-0.301-4.el9.noarch", "Installed: cockpit-bridge-300.4-1.0.1.el9_3.x86_64", "Installed: adobe-source-code-pro-fonts-2.030.1.050-12.el9.1.noarch", "Installed: gsettings-desktop-schemas-40.0-6.el9.x86_64", "Installed: cockpit-pcp-300.4-1.0.1.el9_3.x86_64", "Installed: pcp-6.0.5-4.0.1.el9.x86_64", "Installed: libproxy-0.4.15-35.el9.x86_64", "Installed: glib-networking-2.68.3-3.el9.x86_64"]} proxmox-iso.linux: proxmox-iso.linux: NO MORE HOSTS LEFT *** proxmox-iso.linux: proxmox-iso.linux: PLAY RECAP ***** proxmox-iso.linux: default : ok=6 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 proxmox-iso.linux: ==> proxmox-iso.linux: Provisioning step had errors: Running the cleanup provisioner, if present... ==> proxmox-iso.linux: Stopping VM ==> proxmox-iso.linux: Deleting VM Build 'proxmox-iso.linux' errored after 7 minutes 12 seconds: Error executing Ansible: Non-zero exit status: exit status 2

==> Wait completed after 7 minutes 12 seconds

marcinbojko commented 7 months ago

This is not the same error. The fix I or you did, was a success - provisioning starts. It fails, as oracle searches for specific package (I swear, Oracle guys like to complicate things), so there is simply mismatch in package name

marcinbojko commented 7 months ago

Please pull the latest changes, I've found a proper package name.

VorlMaldor commented 7 months ago

this is what I am getting now. ./proxmox_oraclelinux_93.sh Error: Invalid value for variable

on proxmox/variables_proxmox_oraclelinux93.pkvars.hcl line 10: 10: disks = { 11: cache_mode = "writeback" 12: disk_size = "50G" 13: format = "raw" 14: type = "virtio" 15: storage_pool = "vmpool" 16: }

The value for disks is not compatible with the variable's type constraint: attributes "discard" and "io_thread" are required.

Packer validate failed - exiting now

I did figure out that I wasn't using your devel branch before and fixed that. this is the error in that branch.

I tried to add those entries into the disks section and gave Error: 1 error(s) occurred:

Packer validate failed - exiting now

so I removed io_thread and got

Error: Invalid value for variable

on proxmox/variables_proxmox_oraclelinux93.pkvars.hcl line 10: 10: disks = { 11: cache_mode = "writeback" 12: disk_size = "50G" 13: format = "raw" 14: type = "virtio" 15: storage_pool = "vmpool" 16: discard = "true" 17: }

The value for disks is not compatible with the variable's type constraint: attribute "io_thread" is required.

Thank you much for your time and help.

marcinbojko commented 7 months ago

make sure you did steps from the manual: especially refresh packer and packer modules/plugins, and requirements for ansible. Looks like your Packer plugin version could be too old:


- Init packer by running  `packer init config.pkr.hcl` or `packer init -upgrade config.pkr.hcl`
- Init your ansible by running `ansible-galaxy collection install --upgrade -r ./extra/playbooks/requirements.yml`
VorlMaldor commented 7 months ago

good morning, so I was having issues getting oracle 9.3 to update to a current version of ansible. deployed a new system fedora 39 ran the packer init, and ansioble commands and am still getting:

Error: Invalid value for variable

on proxmox/variables_proxmox_oraclelinux93.pkvars.hcl line 10: 10: disks = { 11: cache_mode = "writeback" 12: disk_size = "50G" 13: format = "raw" 14: type = "virtio" 15: storage_pool = "vmpool" 16: }

The value for disks is not compatible with the variable's type constraint: attributes "discard" and "io_thread" are required.

This is the output from the ansible and packer commands:

manager@fedora:/proxmox-kvm-packer$ packer init config.pkr.hcl Installed plugin github.com/hashicorp/qemu v1.0.10 in "/home/manager/.config/packer/plugins/github.com/hashicorp/qemu/packer-plugin-qemu_v1.0.10_x5.0_linux_amd64" Installed plugin github.com/hashicorp/alicloud v1.1.1 in "/home/manager/.config/packer/plugins/github.com/hashicorp/alicloud/packer-plugin-alicloud_v1.1.1_x5.0_linux_amd64" Installed plugin github.com/hashicorp/proxmox v1.1.7 in "/home/manager/.config/packer/plugins/github.com/hashicorp/proxmox/packer-plugin-proxmox_v1.1.7_x5.0_linux_amd64" Installed plugin github.com/hashicorp/ansible v1.1.1 in "/home/manager/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.1_x5.0_linux_amd64" Installed plugin github.com/hashicorp/vagrant v1.1.2 in "/home/manager/.config/packer/plugins/github.com/hashicorp/vagrant/packer-plugin-vagrant_v1.1.2_x5.0_linux_amd64" Installed plugin github.com/rgl/windows-update v0.15.0 in "/home/manager/.config/packer/plugins/github.com/rgl/windows-update/packer-plugin-windows-update_v0.15.0_x5.0_linux_amd64" manager@fedora:~/proxmox-kvm-packer$ ansible-galaxy collection install --upgrade -r ./extra/playbooks/requirements.yml Starting galaxy collection install process Process install dependency map Starting collection install process 'ansible.posix:1.5.4' is already installed, skipping. 'community.general:8.4.0' is already installed, skipping. 'community.crypto:2.18.0' is already installed, skipping.

manager@fedora:/proxmox-kvm-packer$ ansible --version ansible [core 2.16.4] config file = /etc/ansible/ansible.cfg configured module search path = ['/home/manager/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.12/site-packages/ansible ansible collection location = /home/manager/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)] (/usr/bin/python3) jinja version = 3.1.3 libyaml = True manager@fedora:~/proxmox-kvm-packer$ packer --version Packer v1.10.2

Is there something I am doing wrong?

marcinbojko commented 7 months ago

Are ou on current commit? Please do and paste

git show | head   

from main folder

VorlMaldor commented 7 months ago

That fixed it, pulling the new develop branch this morning. You are supper awesome, thank you for the help!