Comments (19)
I'm seeing this issue with ansible-lint 6.10.0 even after adding the community.general
collection to my requirements.yml
file.
WARNING Unable to load module community.general.timezone at roles/system_config/tasks/main.yml:46 for options validation
WARNING Unable to resolve FQCN for module community.general.timezone
Here's an example job:
https://github.com/smrealms/seed-server/actions/runs/3783650542/jobs/6432363437
And here's what my requirements.yml
looks like:
---
collections:
- community.general
roles:
- src: geerlingguy.docker
version: 5.2.1
- src: hifis.unattended_upgrades
version: v1.12.2
Am I doing something wrong here? Thanks!
from ansible-lint-action.
from ansible-lint-action.
I was able to get this working: (this doesn't cover the action part)
$ ansible-galaxy collection install community.general
---
- name: timezone
hosts: all
gather_facts: true
vars:
tz: Asia/Tokyo
tasks:
- name: "Set the timezone. {{ tz }}"
community.general.timezone:
name: "{{ tz }}"
failed_when: false
from ansible-lint-action.
@ssbarnea @cidrblock thank you! I could complete.
my repo(ommit)
$ tree
.
|-- ansible
| |-- .ansible-lint
| |-- requirements.yml
| `-- roles
my wf
steps:
- uses: actions/checkout@master
- name: copy .ansible-lint
shell: bash
run: |
cp ansible/.ansible-lint .
cp ansible/requirements.yml .
- name: Lint Ansible Playbook
uses: ansible/ansible-lint-action@v6
# uses: ./.github/actions/ansible-lint
with:
args: ansible
from ansible-lint-action.
wooops
$ cat ansible/requirements.yml
---
collections:
- community.general
$ cat ansible/.ansible-lint
# see https://ansible-lint.readthedocs.io/en/latest/configuring/
# List of additional kind:pattern to be added at the top of the default
# match list, first match determines the file kind.
kinds:
- playbook: "**/playbook*/*.{yml,yaml}"
# - galaxy: "**/folder/galaxy.yml"
# - tasks: "**/tasks/*.yml"
# - vars: "**/vars/*.yml"
# - meta: "**/meta/main.yml"
- yaml: "**/*.yaml-too"
from ansible-lint-action.
see https://docs.ansible.com/ansible/latest/galaxy/user_guide.html
Installing both roles and collections from the same requirements file will not work when specifying a custom collection or role install path. In this scenario the collections will be skipped and the command will process each like ansible-galaxy role install would.
and old version
https://docs.ansible.com/ansible/2.9/galaxy/user_guide.html
While both roles and collections can be specified in one requirements file, they need to be installed separately. The ansible-galaxy role install -r requirements.yml will only install roles and ansible-galaxy collection install -r requirements.yml -p ./ will only install collections.
I think, maybe not installed colections.
need command like a ansible-galaxy collections install -r requirements.yml
right?
from ansible-lint-action.
@officel Thanks for the pointers! I should have clarified that this is only an issue in the GitHub Action (locally, where I do have community.general
installed, everything is working fine). I'm not sure what ansible-lint
is doing under the hood to discover community collections. Do I need to run ansible-galaxy collections install -r requirements.yml
in the GHA workflow before I run ansible-lint
?
from ansible-lint-action.
I see. Then it does not seem necessary.
from ansible-lint-action.
I checked again.
I misunderstood because I am not good at English. Sorry 🙇
ansible-lint-action uses creator-ee with docker.
https://github.com/ansible/ansible-lint-action/blob/main/action.yml
creator-ee automatically reads requirements.yml in the top directory of the repository.
The requirements.yml it is based on does not contain the community.general collection we need.
https://github.com/ansible/creator-ee/blob/main/_build/requirements.yml
So when we use this ansible-lint-action, we need to put the collections in our requirements.yml.
No problem.
from ansible-lint-action.
@hemberger Did you get this working? I've modified my action to install the requirements from the root like so:
name: Ansible Deployment
on:
workflow_dispatch:
jobs:
linting:
name: List Ansible Files
runs-on: ubuntu-22.04
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Install Ansible
run: sudo apt-get install -y ansible
- name: Install Ansible-Galaxy Requirements
run: ansible-galaxy install -r requirements.yaml
- name: List Installed Ansible-Galaxy Requirements
run: ansible-galaxy collection list
- name: Linting
uses: ansible/ansible-lint-action@dd225474d15635904348151b9e694472ce0f62a8
with:
path: ansible/
But I'm still getting FQCN resolution failures.
Collections
---
collections:
- name: community.general
- name: community.docker
from ansible-lint-action.
Did you get this working?
No, I haven't been able to get this to work either. Since ansible-lint is running in a docker container, my suspicion is that it will require changes to the creator-ee image or ansible-lint itself.
ansible-lint-action/action.yml
Lines 24 to 27 in dd22547
from ansible-lint-action.
Bummer. @ssbarnea Any ideas on this one?
from ansible-lint-action.
You must have a requirements.yml file on your repo so linter could install these deps itself! Running galaxy before the action does not help as that is not inside the action container.
from ansible-lint-action.
You must have a requirements.yml file on your repo so linter could install these deps itself! Running galaxy before the action does not help as that is not inside the action container.
Thanks for the quick response! In my example job above (#99 (comment)), I have community.general
in my repo's requirements.yml file, but I still get the FQCN warning about it.
from ansible-lint-action.
Fair point. Can we override the path to avoid pushing the galaxy file into root?
from ansible-lint-action.
@Schachte You can pass path
variable but that is not alone enough. You also need to create a config file at the desired location in order to convince linter to consider that path as project directory. Otherwise it will fallback to git and that will report the parent patch as being the project.
from ansible-lint-action.
Was there ever a solution to this? I have a chicken-egg-problem: when I put community.general into the requirements.yml I get an error that
ERROR! Failed to find the collection dir deps: The collection galaxy.yml path '/Users/nik/.cache/ansible-compat/bec60e/collections/ansible_collections/community/general/galaxy.yml' does not exist.
If I do not have community.general in the requirements.yml I get errors with playbooks that use modules from community.general that the dependencies are not in the requirements.yml.
from ansible-lint-action.
I've solved it by reverting to https://github.com/ansible/[email protected] from current @main - which uses 6.14.4.
from ansible-lint-action.
Same issue here, when i move back to v6.11.0 as suggested by @barzog it solves the issue but now my linter is buggy because of a loop-var-prefix[wrong] false positive, that seems to be fixed in a newer version of the linter...
from ansible-lint-action.
Related Issues (20)
- (Ability to) disable verbose output HOT 2
- Couldn't resolve module/action in ansible-lint action HOT 8
- Repository not found: ansible-community/ansible-lint-action HOT 1
- Failed to discover lintable files using git: (Warning and Error) HOT 5
- fatal: detected dubious ownership in repository at '/github/workspace' HOT 10
- Please update the action with ansible-lint 6.9.0 or later HOT 2
- Warning on every run HOT 1
- The action cannot be used as a status check in a branch protection rule HOT 1
- Ansible lint not been able to use community.general.system.timezone HOT 5
- Some ansible lint rule are not checked for the playbook HOT 1
- Update to 6.14.6
- Couldn't resolve module/action error in action but not on system HOT 1
- config ignored ? HOT 2
- Link to github marketplace is broken HOT 2
- `uses: ansible/ansible-lint@v6` yields error "unable to find version `v6`" HOT 1
- Ansible-lint-action is not returning the same result as local ansible-lint HOT 1
- `ansible-lint` outdated HOT 1
- requirements.yml not loaded from given path HOT 3
- ansible-lint fails validating the .github/workflows/ansible-lint.yml HOT 3
- Update to ansible-lint 6.17.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-lint-action.