Unable to run ansible-lint without options
chey opened this issue · 4 comments
One should be able to run this like so:
docker run --rm -v $(pwd):/data cytopia/ansible-lint
... in which case ansible-lint will scan the directory recursively. But it defaults to an argument of --version
and outputs:
ansible-lint 4.2.0
Would like to get rid of the default --version
argument.
So I was getting errors when trying to run the container as i mentioned above with -v
like so:
$ docker run --rm -v $(pwd):/data cytopia/ansible-lint -v
Traceback (most recent call last):
File "/usr/bin/ansible-lint", line 11, in <module>
sys.exit(main())
File "/usr/lib/python3.6/site-packages/ansiblelint/__main__.py", line 153, in main
args = get_playbooks_and_roles(options=options)
File "/usr/lib/python3.6/site-packages/ansiblelint/utils.py", line 774, in get_playbooks_and_roles
universal_newlines=True).split()))
File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
**kwargs).stdout
File "/usr/lib/python3.6/subprocess.py", line 423, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'git': 'git'
I have an easy solution to this. Change the following line from:
docker-ansible-lint/Dockerfile
Line 32 in ab98328
to:
&& apk add --no-cache python3 git \
Thanks!
ansible-lint
also requires the path as its last param, so after the -v
you need to add a path, eg: .
:
docker run --rm -v $(pwd):/data cytopia/ansible-lint -v .
ansible-lint
also requires the path as its last param, so after the-v
you need to add a path, eg:.
:docker run --rm -v $(pwd):/data cytopia/ansible-lint -v .
The only problem with this is ansible-lint
will only check the current directory. Without a .
it will check recursively and honor your .ansible-lint
configuration. In the "recursive mode" ansible-lint
needs to have git
installed or it fails.