"msg": "'ansible.vars.hostvars.HostVarsVars object' has no attribute 'kubeadm_init'"}
时间: 2024-05-25 18:18:25 浏览: 190
This error message indicates that the variable 'kubeadm_init' is not defined in the hostvars of the Ansible playbook. You may have misspelled the variable name or forgot to define it. Check your playbook and make sure that the variable is properly defined in the hostvars for the target host.
相关问题
fatal: [controller2]: FAILED! => {"msg": "'ansible.vars.hostvars.HostVarsVars object' has no attribute 'kubeadm_init'"}
This error message typically indicates that the playbook or role being executed is trying to access a variable or attribute that does not exist for the specified host in the inventory.
In this case, it seems that the attribute `kubeadm_init` is not defined for `controller2` in the inventory. You may need to check your inventory file or dynamic inventory script to ensure that the necessary variables are defined correctly for each host.
If you are using a dynamic inventory script, you may also need to modify it to include the necessary variables for each host. Additionally, you should check that any variables or attributes being accessed are spelled correctly and match the names defined in your playbook or role.
[root@ansible ansible_playbook]# ansible-playbook -C rsync.yaml ERROR! this task 'copy' has extra params, which is only allowed in the following modules: ansible.builtin.raw, ansible.legacy.add_host, ansible.builtin.meta, ansible.legacy.include, ansible.legacy.import_role, script, ansible.legacy.raw, group_by, ansible.builtin.shell, ansible.legacy.win_command, include, shell, include_vars, ansible.builtin.import_tasks, add_host, ansible.builtin.include_vars, ansible.legacy.include_role, ansible.builtin.include_role, ansible.legacy.include_vars, ansible.legacy.win_shell, ansible.legacy.group_by, import_tasks, ansible.builtin.set_fact, ansible.builtin.command, ansible.builtin.include_tasks, include_tasks, ansible.builtin.script, ansible.builtin.include, raw, meta, ansible.legacy.set_fact, ansible.builtin.add_host, ansible.legacy.script, ansible.legacy.import_tasks, win_command, ansible.builtin.win_shell, include_role, win_shell, set_fact, ansible.legacy.shell, ansible.legacy.command, import_role, ansible.legacy.meta, ansible.builtin.import_role, ansible.legacy.include_tasks, ansible.builtin.group_by, ansible.builtin.win_command, command The error appears to be in '/etc/ansible/ansible_playbook/rsync.yaml': line 11, column 7, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - name: create rsync local user ^ here
这个错误提示表明在'/etc/ansible/ansible_playbook/rsync.yaml'文件的第11行第7列附近存在错误。根据错误信息,问题出现在名为"create rsync local user"的任务上。这个任务可能使用了不被允许的额外参数。
根据Ansible的文档,只有特定的模块允许使用额外参数,如:ansible.builtin.raw、ansible.legacy.add_host、ansible.builtin.meta等。你需要检查该任务的参数,确保没有使用不被允许的额外参数。
阅读全文