Ansible 2.0 not supported
larsla opened this issue · 25 comments
When trying to use Ansigenome with Ansible 2.0 i get this error:
ERROR! 'ansigenome_info' is not a valid attribute for a RoleMetadata
I checked the MetaData class in ansible 2.0 and it seems to be more strict than earlier.
https://github.com/ansible/ansible/blob/devel/lib/ansible/playbook/role/metadata.py
Do you have any idea how this could be solved? I volunteer to help fix it, but I'm unsure how to proceed.
Hi @larsla
Me and I think also @nickjj would appreciate your help here. This issue is related to #23 and @nickjj somehow closed it. The trick which is already used is to move the ansigenome_info
to meta/ansigenome.yml
for Ansible 2.0 but Ansigenome can not handle that right now. To fix this, the script would need to be changed so that it tries to read the metadata from meta/ansigenome.yml
first. I tired that once but gave up because if the code quallity. @nickjj agrees that the script could need some rework. If you want to help, that would be awesome 👍
@nickjj is there a specific type of fix you're looking for here? If so, can you let me know? I'd be happy spend some time this weekend on this issue so I can start my 2.0 upgrade work next week.
Hey @drybjed, would you mind guiding @nathanhruby on what would need to be done to upgrade Ansigenome to be 2.0 compatible?
I haven't used Ansible in quite some time and I'm not sure of any of the changes.
@nathanhruby Hi! Right off the bat the biggest benefit would be to change the default ansigenome
metadata file. Right now ansigenome
expects the ansigenome_info
dict in the meta/main.yml
of the Ansible role, however Ansible does not tolerate it at all. In my roles, I moved that dictionary to separate meta/ansigenome.yml
file which is not an issue for Ansible.
There should be some changes in the default template that interprets the dictionary data. Ansible Galaxy recently switched from role ids to user/role
naming scheme in the Galaxy URLs. Since role id is not easy to find anymore (maybe through API), I would siwtch the ansigenome_info.galaxy_id
variable to just ansigenome_info.galaxy
bool activating or diactivating the custom template parts, and used the user/role information from separate variable. I'm not sure if Ansible Galaxy uses GitHub user/repository mapping or GitHub user/Galaxy role name, I suppose that could be tested.
One other thing that I would change is removal of role categories and switch to Ansible Galaxy tags.
@larsla, @nathanhruby any progress?
sorry I got pulled away from the 2.0 upgrade, of which this was a blocker. I haven't had time to get back to it. I will try to carve out some time this week.
Hello everybody, this topic remains unattended even that in the forks there are a lot of changes in this direction. It would be really helpful if you can somehow integrate usage for Ansible > 2.0
Thanks!
@mihai-satmarean I mean that https://github.com/ypid/ansigenome already includes a workaround. It might need some rework but then it can be proposed in a separate PR to fix this issue.
Since we would like to automate our documentation with this tool, but we have no bandwidth to address this would be great if someone can point us to a working branch/fork that just works with ansible >2.0.
Thank you!
As said, https://github.com/ypid/ansigenome/tree/devel includes a patch. It just works with Ansible 2.0 and above (but should be reworked to be merged into Ansigenome).
hi there maybe I'm missing something but I get the following error
File "build/bdist.linux-x86_64/egg/ansigenome/scan.py", line 83, in init
File "build/bdist.linux-x86_64/egg/ansigenome/scan.py", line 183, in scan_roles
File "build/bdist.linux-x86_64/egg/ansigenome/scan.py", line 410, in read_and_validate_meta
KeyError: 'keyids_file'
This is if I run the command like
ansigenome gendoc /etc/ansible/roles/ -f md
@adriaand007 Thanks for reporting! Fixed. The idea is that the keyids_file
is provided in Ansigenome configuration (example: https://github.com/debops/debops-keyring/blob/master/keyids)
keyids_file: /home/user/.ansible/ypid-ansible-common/submodules/debops-keyring/keyids
I made it optional. You can try with the latest commit from my fork.
ypid, Thanks for the reply, I had cloned the repo instead of the other ansigenome I had installed, and init a role. After that trying to scan, gendoc or anything would reply
No roles were found at this path:
Also what I understand is that meta/main.yml became more restrictive and that is why ansigenome creates it's own file now.
This looks like a very useful project,
Can anyone help by pointing to a working version with Ansible 2.3? Maybe even a new branch?
Thank you very much!
As said, https://github.com/ypid/ansigenome/tree/devel includes a patch.
Hi @ypid I had used that repo to generate a new role, and meta/ansigenome.yml is not created, the result of the command "ansigenome scan " against a role created by asnigenome results in
`ansigenome gendoc -l ansigenome_test
Traceback (most recent call last):
File "/usr/local/bin/ansigenome", line 6, in <module>
exec(compile(open(__file__).read(), __file__, 'exec'))
File "/Volumes/diskE/Users/msn3/Documents/ansible-workspace/used_for_components/ansigenome/bin/ansigenome", line 326, in <module>
main()
File "/Volumes/diskE/Users/msn3/Documents/ansible-workspace/used_for_components/ansigenome/bin/ansigenome", line 322, in main
fn(args, options, reloaded_config, parser)
File "/Volumes/diskE/Users/msn3/Documents/ansible-workspace/used_for_components/ansigenome/bin/ansigenome", line 161, in execute_gendoc
Scan(args, options, config, gendoc=True)
File "/Volumes/diskE/Users/msn3/Documents/ansible-workspace/used_for_components/ansigenome/ansigenome/scan.py", line 83, in __init__
self.scan_roles()
File "/Volumes/diskE/Users/msn3/Documents/ansible-workspace/used_for_components/ansigenome/ansigenome/scan.py", line 183, in scan_roles
if self.read_and_validate_meta(key):
File "/Volumes/diskE/Users/msn3/Documents/ansible-workspace/used_for_components/ansigenome/ansigenome/scan.py", line 410, in read_and_validate_meta
keyring_entities = self._get_debops_keyring_entities(self.config["keyids_file"])
KeyError: 'keyids_file'
Hm, Windows is unsupported I guess ;-) But I will look at it. Just the python stacktrace without linebreaks makes me nervous. Can you update the comment and use multiline code formating :) ? Although I think I spotted the issue. There was an issue a few comments above which I fixed #33 (comment). Your stacktrace suggests that you don’t have the fix yet. Please run git pull
and confirm that ypid@39d7b1f is included.
https://help.github.com/articles/creating-and-highlighting-code-blocks/
Actually I am running it in a mac
I had run
/Library/Python/2.7/site-packages# sudo git clone https://github.com/ypid/ansigenome.git
@mihai-satmarean Ah, mac right. Sorry for that :)
Did the fresh git clone fix it?
nope.
There is still an issue with your setup. Line 410 in scan.py
does not match up: https://github.com/ypid/ansigenome/blob/39d7b1fd2e4385d689efc1d364b0d30ff460e4da/ansigenome/scan.py#L410
Maybe you forgot pip install or something.
call me names, I forgot to run setup
it works now.
Need to learn how to use it properly
Hey folks, any update on this issue. The repo docs didn't say ansible2.0+ isn't supported. Is anyone working on this as of now?
Nobody is working on it as far as I know. Feel free to help.