ansible / galaxy-issues

This repository exists solely for the tracking of user issues with Ansible Galaxy.
20 stars 3 forks source link

Playbook name blank for identical role name and playbook name #250

Closed mpetruzelli closed 6 years ago

mpetruzelli commented 7 years ago

Galaxy role structured as:

 - defaults/
 - provision_instance.yml
 - meta/
 - tasks/
 - templates/

Requirements.yml

- src: https://github.com/provision_instance
  scm: git

Run: ansible-galaxy install -r requirements.yml --ignore-errors --roles-path roles --force

Expected output:

roles/
 - defaults/
 - provision_instance.yml
 - meta/
 - tasks/
 - templates/

Actual Output:

roles/
 - defaults/
 - .yml
 - meta/
 - tasks/
 - templates/

The provision instance playbook file (provision_instance.yml) has been renamed (.yml).

If I check in a file instance.yml Output

roles/
 - defaults/
 - .yml
 - instance.yml
 - meta/
 - tasks/
 - templates/
mpetruzelli commented 7 years ago

Additional info:

It seems if the name of the repo and the name of the playbook match at all, the playbook name is blanked.

Example:

Repo Name: consul Playbook Name: deploy_consul.yml

requirements.yml:

- src: https://github.com/consul
  scm: git

Repo Structure:

 - meta/
 - vars/
 - templates/
 - deploy_consul.yml

Expected behavior of ansible-galaxy install -r requirements.yml --ignore-errors --roles-path roles --force:

 - meta/
 - vars/
 - templates/
 - deploy_consul.yml

ACTUAL behavior of ansible-galaxy install -r requirements.yml --ignore-errors --roles-path roles --force:

 - meta/
 - vars/
 - templates/
 - deploy_.yml
chouseknecht commented 7 years ago

@mpetruzelli

Can you share an actual requirements.yml file, please. Neither example contains a URL pointing to a real GitHub repo. Having an example to use for testing would be helpful.

Is the issue that you're attempting to place a playbook in the top level directory of the repo, and it's not being installed correctly?

mpetruzelli commented 7 years ago

Note: This is only affected in Ansible 2.3.0

Take a look here:

https://github.com/mpetruzelli/galaxy_test

requirements.yml file provided, and install command as well.

neliseev commented 7 years ago

+1 ansible 2.3.0.0

if any file inside role contain role name, ansible remove it. In 2.2 all works well...

rsperl commented 7 years ago

I opened a ticket with rhel thinking this was a tower issue before realizing it was just ansible-galaxy. Repos to duplicate the error: https://github.com/rsperl/RHEL-01839740-playbook

kblcuk commented 7 years ago

FYI at least in my case this manifests only if I use github repo as src:

- src: https://github.com/Stouts/Stouts.collectd
  name: collectd
$ ansible-galaxy install --role-file=ansible-dependencies.yml --force
- extracting collectd to /Users/alex/Code/operations/ansible/community_roles/collectd
- collectd was installed successfully

$ l ansible/community_roles/collectd/tasks
total 48
drwxr-xr-x   8 alex  staff   272B May  5 14:35 .
drwxr-xr-x  15 alex  staff   510B May  5 14:35 ..
-rw-rw-r--   1 alex  staff   664B Nov 25 12:26 .yml
-rw-rw-r--   1 alex  staff   616B Nov 25 12:26 config

However, pointing to tar archive directly seems to correctly:

- src: https://github.com/Stouts/Stouts.collectd/archive/2.2.2.tar.gz
  name: collectd
- downloading role from https://github.com/Stouts/Stouts.collectd/archive/2.2.2.tar.gz
- extracting collectd to /Users/alex/Code/operations/ansible/community_roles/collectd
- collectd was installed successfully

$ l ansible/community_roles/collectd/tasks
total 48
drwxr-xr-x   8 alex  staff   272B May  5 14:34 .
drwxr-xr-x  15 alex  staff   510B May  5 14:34 ..
-rw-rw-r--   1 alex  staff   664B Nov 25 12:26 collectd.yml
supercoffee commented 7 years ago

I'm also seeing this. In my case, templates are being renamed in roles that are pulled in by ansible galaxy. Version 2.2.1.0 works fine, 2.3.0.0 completely breaks playbooks.

supercoffee commented 7 years ago

Okay, there's already been a PR for this here. It's in devel already.

rixx commented 7 years ago

I have run into the same issue – the PR has now been merged; in which ansible version is it expected?

chouseknecht commented 6 years ago

This issue was moved to ansible/galaxy#75