I was working on creating a YAML file with the below details using the Ansible playbook —
tasks:
- name: “add content into cluster.yaml file”
ansible.builtin.blockinfile:
path: /home/ansible/ansible_rancher_k8s_installation/cluster.yaml
block: |if you intended to deploy Kubernetes in an air-gapped environment,
please consult the documentation on how to configure custom RKE images.
nodes:- address:
internal_address: “”
role:- controlplane
- etcd
- worker
user: rke
- address:
but I am getting an error as below —
[ansible@ansible-controller playbooks]$ ansible-playbook ./01-create-rke-k8s-cluster.yaml --check
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’
[WARNING]: While constructing a mapping from /home/ansible/ansible_rancher_k8s_installation/playbooks/01-create-rke-k8s-cluster.yaml, line 2, column 3, found a duplicate dict key (tasks). Using
last defined value only.
PLAY [Run ansible playbook in ansible-controller host] **********************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************************
ok: [localhost]
TASK [add content into cluster.yaml file] ***********************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Unsupported parameters for (ansible.builtin.blockinfile) module: nodes Supported parameters include: attributes, backup, block, content, create, delimiter, directory_mode, follow, force, group, insertafter, insertbefore, marker, marker_begin, marker_end, mode, owner, path, regexp, remote_src, selevel, serole, setype, seuser, src, state, unsafe_writes, validate”}
PLAY RECAP ******************************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
[ansible@ansible-controller playbooks]
can someone guide me how I can define those attributes