larsks / ansible-toolbox Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
I have custom roles on $(pwd)/roles
dir, but since ansible-role
generate the playbook in /tmp
the path is ignored. I'm running with ANSIBLE_ROLES_PATH=
pwd/roles ansible-role ...
to fix that, but it should be defined to respect the role-search-path
Hi,
I found this issue while run ansible-role with sudo command:
Traceback (most recent call last): File "/usr/local/bin/ansible-role", line 9, in <module> load_entry_point('ansible-toolbox==0.2', 'console_scripts', 'ansible-role')() File "build/bdist.linux-x86_64/egg/ansible_toolbox/cmd/role.py", line 37, in main File "build/bdist.linux-x86_64/egg/ansible_toolbox/cmd/role.py", line 33, in main File "/usr/lib64/python2.7/subprocess.py", line 536, in check_call retcode = call(*popenargs, **kwargs) File "/usr/lib64/python2.7/subprocess.py", line 523, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__ errread, errwrite) File "/usr/lib64/python2.7/subprocess.py", line 1343, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory
To reproduce, just type:
$ sudo ansible-role role_name
Has some way to run it with sudo?
Thanks
I have this task:
- name: Symlink "smartless" in "/usr/local/bin/"
file:
state: link
src: "{{ smartless_clone_dir_path }}/smartless/smartless"
dest: "/usr/local/bin/smartless"
owner: "{{ smartless_user_name | default(omit) }}"
group: "{{ smartless_user_name | default(omit) }}"
mode: "u+rwx,g+rwx,o+rx-w"
And this error using ansible-role
:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error while linking: [Errno 13] Permission denied", "path": "/usr/local/bin/smartless", "state": "absent"}
I managed to get past the error but I don't know how, I tried -K, -b, -u but it didn't work then suddenly it worked
Can someone explain me? (it's been a while I used ansible tho)
Also this tool is really useful
One very useful script to have would an ansible-ssh
which would start an interactive ssh session with the $1 hostname from inventory ini.
This can be implemented in few lines of bash or python and it would have to load all ssh info from ansible config using ansible-inventory command.
This looks interesting and I would like to try it out. Is this an ansible module? If so, how do I install it? A little section with some pointers in the readme about getting it running would be really helpful for those of us unfamiliar with what you wrote here.
Thanks!
Would be nice to implement --limit
to apply ansible-role
only for group of hosts from inventory instead of all.
I have a suggestion.
How about using inventory from ansible.cfg by default instead of localhost?
Or the same way as ansible do it:
Hey,
I would first like to congratulate you on this project.
It's aims to be everything I ever found missing in ansible...
It's often unclear to me how do people work and develop with ansible without the wrappers your project provides.
Now, having said that... Is the project bit rotting? :)
Did it continue to live somewhere else?
When running a playbook, adding the --diff
flag will cause changes (e.g., rendered template files, etc.) to be displayed in Ansible's output. It would be nice if ansible-role
did the same:
$ ansible-role -I [IP], postfix --diff
Presently, the above command results in:
ansible-role: error: unrecognized arguments: --diff
Commit 496581a (fix issues around the use of relative paths) moves the generated temp playbook file to /tmp instead of .
, but this means the role search path is now /tmp/roles instead of ./roles, as search is relative to the playbook directory.
That breaks the simplest example from the docs:
For example, if you have a role roles/testrole, you can run it like this:
ansible-role testrole
It likely broke the Travis build as well:
ERROR! the role 'testrole' was not found in /tmp/roles:/home/travis/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/tmp
The error appears to have been in '/tmp/tmptMm7Wj'
To fix, you could probably prepend $PWD/roles
to the role search path, although this would leave /tmp/roles in there.
load_entry_point('ansible-toolbox==0.2', 'console_scripts', 'ansible-role')()
File "/home/lwm/.local/share/virtualenvs/x-DA8ldsYh/lib/python3.5/site-packages/ansible_toolbox/cmd/role.py", line 37, in main
App().main()
File "/home/lwm/.local/share/virtualenvs/x-DA8ldsYh/lib/python3.5/site-packages/ansible_toolbox/cmd/role.py", line 26, in main
gather=args.gather,
File "/home/lwm/.local/share/virtualenvs/x-DA8ldsYh/lib/python3.5/tempfile.py", line 622, in func_wrapper
return func(*args, **kwargs)
TypeError: a bytes-like object is required, not 'str'
Just installed ansible-toolbox and tried to run one of my roles:
maroz@rabbit:/etc/ansible$ ansible-role add_ssh_fingerprint_to_known_hosts -i ubuntu-hosts
Traceback (most recent call last):
File "/usr/local/bin/ansible-role", line 9, in
load_entry_point('ansible-toolbox==1.0', 'console_scripts', 'ansible-role')()
File "build/bdist.linux-x86_64/egg/ansible_toolbox/cmd/role.py", line 37, in main
File "build/bdist.linux-x86_64/egg/ansible_toolbox/cmd/role.py", line 20, in main
File "build/bdist.linux-x86_64/egg/ansible_toolbox/base.py", line 11, in get_template
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 812, in get_template
return self._load_template(name, self.make_globals(globals))
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 774, in _load_template
cache_key = self.loader.get_source(self, name)[1]
File "/usr/lib/python2.7/dist-packages/jinja2/loaders.py", line 235, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: role.yml
Ansible version: ansible 2.0.2.0
Python version: Python 2.7.10
OS: Ubuntu 15.10
can we run multiple roles with ansible-role ??
Adding --check functionality would be amazing.
Argparse treats options as strings, so -e test="123" means for it:
dest = e
options= 'test=123'
this is problematic when using spaces or json in extra vars:
ansible-eval -e test='[1, 2, 3]' "{{ test }}"
will show [1,
This can be solved by using double quotes:
ansible-eval -e test="'[1, 2, 3]'" "{{ test }}"
will show [1,2,3]
Or surrounding whole extra argument:
ansible-eval -e "test=\"{\"key\": \"value\"}\"" "{{ test }}"
This indeed is not 1 to 1 same mechanism as with ansible-playbook
, so it's worth mentioning. Fixing that is not easiest thing, but quoting every extra-arg which has "=" in it is doable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.