V
V
vitkuz5732021-02-04 13:34:50
Ansible
vitkuz573, 2021-02-04 13:34:50

How to solve ansible-lint error?

Ansible-lint throws the following error when running GitHub Actions:

==> Linting /github/workspace/playbook.yml…
Couldn't parse task at /github/workspace/roles/misc/tasks/configure/configure-debian.yml:2 (conflicting action statements: hostname, __line__

The error appears to be in '<unicode string>': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

(could not open file to display line))
{ 'hostname': { '__file__': '/github/workspace/roles/misc/tasks/configure/configure-debian.yml',
                '__line__': 4,
                'name': '{{ hostname }}'},
  'name': 'Setting hostname'}


The file itself looks like this:
---
- name: Setting hostname
  hostname:
    name: "{{ hostname }}"


What is wrong here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2021-02-04
@mureevms

{{ hostname }}it is an ansible built-in variable. Try to name the variable differently or redefine something else, like

- name: Setting hostname
  hostname:
    name: "{{ inventory_hostname }}"

inventory_hostname is also a built-in variable that takes the value specified in the inventory file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question