Kubeinit / kubeinit

Ansible automation to have a KUBErnetes cluster INITialized as soon as possible...
https://www.kubeinit.org
Apache License 2.0
218 stars 57 forks source link

FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_host'"} #647

Closed jeffabailey closed 1 year ago

jeffabailey commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

Error when running final step of installation.

FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_host'"}

To Reproduce Steps to reproduce the behavior:

  1. Install on a fresh Raspian or Rocky linux system using these instructions: https://github.com/Kubeinit/kubeinit#directly-executing-the-deployment-playbook
  2. See this error output: full-error-output.txt

Expected behavior

A complete installation.

Screenshots If applicable, add screenshots to help explain your problem.

Infrastructure

Deployment command

Followed instructions.

Inventory file diff

Run the following command:

diff \
    <(curl https://raw.githubusercontent.com/Kubeinit/kubeinit/main/kubeinit/hosts/k8s/inventory) \
    <(curl https://raw.githubusercontent.com/Kubeinit/kubeinit/main/kubeinit/hosts/okd/inventory)

And paste the output:

$ diff \
    <(curl https://raw.githubusercontent.com/Kubeinit/kubeinit/main/kubeinit/hosts/k8s/inventory) \
    <(curl https://raw.githubusercontent.com/Kubeinit/kubeinit/main/kubeinit/hosts/okd/inventory)
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                     % Total    % Received % Xferd  Average Speed   Time    Time        T i         Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 e  Curr--:--:-- --:--:-- --:--:--     0ent
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- 100    14  100    14    0     0     59      0 --:--:-- --:--:-- --:--:--    60
100    14  100    14    0     0     56      0 --:--:-- --:--:-- --:--:--    56

Additional context Add any other context about the problem here.

ccamacho commented 2 years ago

Hi, would you mind running the de[ployment like this?

ansible-playbook     -v --user root     -e kubeinit_spec=k8s-libvirt-1-1-1   -e hypervisor_hosts_spec='[[ansible_host=nyctea],[ansible_host=tyto]]'      ./kubeinit/playbook.yml

I bet you are using the default inventory file, there might be a nit there.

Gl1TcH-1n-Th3-M4tR1x commented 2 years ago

Or you can have:

hypervisor_hosts:
  hosts:
    hypervisor-01:
      ansible_host: nyctea
    hypervisor-02:
      ansible_host: tyto

In your inventory.yml file

jeffabailey commented 2 years ago

@ccamacho I updated to the latest code and ran the command.

I encountered a new error.

fatal: [hypervisor-01]: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host \"nyctea\". Make sure this host can be reached over ssh: Warning: Identity file /root/.ssh/kubeinit_id_rsa not accessible: Permission denied.\nCan't open user config file /root/.ssh/k8scluster_config: Permission denied\r\n", "unreachable": true}

I wonder if it makes sense for me to clone this repo and set up a test like this one for Rocky Linux & Raspian?

https://github.com/Kubeinit/kubeinit/actions/workflows/distro_test.yml

What do you think?

@Gl1TcH-1n-Th3-M4tR1x Thanks for the input, but the inventory.yml already contains that configuration.

ccamacho commented 1 year ago

I didnt see this again @jeffabailey I built all the packages for aarch64 but there are some changes needed in the guest vm images to have it running in ARM. (Rocky should work ootb I dont think this will ever work on a raspberry)