添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
豪情万千的骆驼  ·  [WARNING]: provided ...·  昨天    · 
活泼的铁链  ·  Sudo bench setup ...·  昨天    · 
爱喝酒的手电筒  ·  Add settings to ...·  昨天    · 
慷慨的蚂蚁  ·  Ansible.cfg inventory ...·  昨天    · 
高大的眼镜  ·  [WARNING]: provided ...·  昨天    · 
正直的键盘  ·  ACF | Date Time Picker·  4 月前    · 
果断的甜瓜  ·  Using an Oracle ...·  7 月前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whenever I execute the dev/dev.yml playbook, I'm always located inside the ansible folder.
Inside my ansible.cfg , I have extended the roles_path to tell ansible to look for roles inside the ./roles as well as the ./dev/roles .
My dev/dev.yml playbook uses roles from both folders and it works perfectly fine.

However, when I try to edit the dev/dev.yml file in VSCode, I get an error stating that the roles cannot be found:

Command failed: ansible-playbook /myrepo/ansible/dev/dev.yml --syntax-check
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
ERROR! the role 'myrole' was not found in <default paths>

Solution

From what I found by searching this repository, the README and the settings of the extension, there is no way to configure the behavior of syntax checking when it's done using ansible-playbook.
I would like to either disable the checking entirely or be able to change the configuration to tell it to take my ansible.cfg into account. Or simply extend the role_paths directly even if it's not DRY.

Alternatives

Disabling the Ansible extension entirely.
Attempted to switch to ansible-lint but ticking the checkbox didn't change anything.

Additional context

No response

Hi and thanks for answering.

It seems I don't have ansible-lint installed:

Error: Command failed: which ansible-lint
    at ChildProcess.exithandler (node:child_process:406:12)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Socket.<anonymous> (node:internal/child_process:450:11)
    at Socket.emit (node:events:390:28)
    at Pipe.<anonymous> (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'which ansible-lint',
  stdout: '',
  stderr: ''

And right after this error, I get the usual error from ansible-playbook --syntax-check.

Okay, thanks.
Also I suspect that ansible.cfg is not picked up by the vscode extension. Could you try opening the entire ansible directory (the root as you mentioned) in the vscode and check ?
This because the extension checks for ansible config file in two ways:

  • the workspace root of the current working directory in the vscode
  • ANSIBLE_CONFIG env variable.
  • Maybe, you can even try checking by setting the ANSIBLE_CONFIG env variable to point the config file.

    That would be a good idea but it wouldn't solve my issue.
    I still think adding a setting for the user to set the ansible.cfg would be a good idea.
    I don't want to use the environment variable because this is only an issue on this specific project.
    And I can't move the ansible.cfg file to the root of the repository because it would add clutter for the other team members.

    Could you keep this issue open, please?

    Bumps [lxml](https://github.com/lxml/lxml) from 4.9.1 to 4.9.2.
    - [Release notes](https://github.com/lxml/lxml/releases)
    - [Changelog](https://github.com/lxml/lxml/blob/master/CHANGES.txt)
    - [Commits](lxml/lxml@lxml-4.9.1...lxml-4.9.2)
    updated-dependencies:
    - dependency-name: lxml
      dependency-type: direct:production
      update-type: version-update:semver-patch
    Signed-off-by: dependabot[bot] <[email protected]>
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>