techno-tim / k3s-ansible

The easiest way to bootstrap a self-hosted High Availability Kubernetes cluster. A fully automated HA k3s etcd install with kube-vip, MetalLB, and more. Build. Destroy. Repeat.
https://technotim.live/posts/k3s-etcd-ansible/
Apache License 2.0
2.41k stars 1.05k forks source link

Error while evaluating conditional (proxmox_lxc_configure) on fresh install #295

Closed axelmvt closed 1 year ago

axelmvt commented 1 year ago

Expected Behavior

Run the playbook

I'm getting an error when running the site.yml

Current Behavior

`k3s@ansible-01:~/k3s-ansible$ ansible-playbook ./site.yml --ask-pass --ask-become-pass -i ./inventory/my-cluster/hosts.ini SSH password: BECOME password[defaults to SSH password]: [WARNING]: Could not match supplied host pattern, ignoring: proxmox

PLAY [proxmox] ** skipping: no hosts matched

PLAY [k3s_cluster] **

TASK [Gathering Facts] ** ok: [192.168.10.131] ok: [192.168.10.133] ok: [192.168.10.132] ok: [192.168.10.130] ok: [192.168.10.134]

TASK [lxc : Check for rc.local file] **** fatal: [192.168.10.130]: FAILED! => {"msg": "The conditional check 'proxmox_lxc_configure' failed. The error was: error while evaluating conditional (proxmox_lxc_configure): 'proxmox_lxc_configure' is undefined. 'proxmox_lxc_configure' is undefined\n\nThe error appears to be in '/home/k3s/k3s-ansible/roles/lxc/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Check for rc.local file\n ^ here\n"} fatal: [192.168.10.131]: FAILED! => {"msg": "The conditional check 'proxmox_lxc_configure' failed. The error was: error while evaluating conditional (proxmox_lxc_configure): 'proxmox_lxc_configure' is undefined. 'proxmox_lxc_configure' is undefined\n\nThe error appears to be in '/home/k3s/k3s-ansible/roles/lxc/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Check for rc.local file\n ^ here\n"} fatal: [192.168.10.132]: FAILED! => {"msg": "The conditional check 'proxmox_lxc_configure' failed. The error was: error while evaluating conditional (proxmox_lxc_configure): 'proxmox_lxc_configure' is undefined. 'proxmox_lxc_configure' is undefined\n\nThe error appears to be in '/home/k3s/k3s-ansible/roles/lxc/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Check for rc.local file\n ^ here\n"} fatal: [192.168.10.133]: FAILED! => {"msg": "The conditional check 'proxmox_lxc_configure' failed. The error was: error while evaluating conditional (proxmox_lxc_configure): 'proxmox_lxc_configure' is undefined. 'proxmox_lxc_configure' is undefined\n\nThe error appears to be in '/home/k3s/k3s-ansible/roles/lxc/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Check for rc.local file\n ^ here\n"} fatal: [192.168.10.134]: FAILED! => {"msg": "The conditional check 'proxmox_lxc_configure' failed. The error was: error while evaluating conditional (proxmox_lxc_configure): 'proxmox_lxc_configure' is undefined. 'proxmox_lxc_configure' is undefined\n\nThe error appears to be in '/home/k3s/k3s-ansible/roles/lxc/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Check for rc.local file\n ^ here\n"}

PLAY RECAP ** 192.168.10.130 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 192.168.10.131 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 192.168.10.132 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 192.168.10.133 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 192.168.10.134 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0`

Steps to Reproduce

1. 2. 3. 4.

Context (variables)

Operating system:

Hardware:

Variables Used

all.yml

k3s_version: "v1.25.9+k3s1"
ansible_user: NA
systemd_dir: "/etc/systemd/system"

flannel_iface: "eth0"

apiserver_endpoint: "192.168.30.222"

k3s_token: "NA"

extra_server_args: >-
  {{ extra_args }}
  {{ '--node-taint node-role.kubernetes.io/master=true:NoSchedule' if k3s_master_taint else '' }}
  --tls-san {{ apiserver_endpoint }}
  --disable servicelb
  --disable traefik
extra_agent_args: >-
  {{ extra_args }}

kube_vip_tag_version: "v0.5.12"

metal_lb_speaker_tag_version: "native"
metal_lb_controller_tag_version: "layer2"

metal_lb_ip_range: "192.168.30.80-192.168.30.90"

Hosts

host.ini

[master]
192.168.10.130
192.168.10.131
192.168.10.132

[node]
192.168.10.133
192.168.10.134

# only required if proxmox_lxc_configure: true
# must contain all proxmox instances that have a master or worker node
# [proxmox]
# 192.168.30.43

[k3s_cluster:children]
master
node

Possible Solution

timothystewart6 commented 1 year ago

This is odd because it passes CI https://github.com/techno-tim/k3s-ansible/actions/runs/4826948389

Which OS are you using for the nodes?

axelmvt commented 1 year ago

Hi there! They are proxmox vms running Ubuntu 20.04.6 LTS (Focal Fossa). The ansible host is a proxmox container Ubuntu 22.10

Brainpitcher commented 1 year ago

yeap i confirm, getting the same :) my vms (Ubuntu 20.04.6) is running on vmware esxi and an ansible host is Ubuntu 20.04.6

timothystewart6 commented 1 year ago

Can you be sure you have the latest ansible installed https://docs.technotim.live/posts/ansible-automation/#installing-the-latest-version-of-ansible and you run a reset on your cluster before trying again? Again, this works in CI which means that it is something with your config or environment

Also, the check list is here for troubleshooting https://github.com/techno-tim/k3s-ansible/discussions/20