ansible / galaxy

Legacy Galaxy still available as read-only on https://old-galaxy.ansible.com - looking for the new galaxy -> https://github.com/ansible/galaxy_ng
Apache License 2.0
854 stars 329 forks source link

ansible-galaxy install --force no longer replaces roles #74

Open chouseknecht opened 7 years ago

chouseknecht commented 7 years ago

From @jxn on April 13, 2017 18:10

After the version bump to 2.3.0, it seems install --force no longer forces an overwrite. We have been using this to "upgrade" roles stored in git, but they are no longer pulled in.

Here's the command used: ansible-galaxy install --force -r ansible/requirements.yml -p ansible/roles/

Here's an example requirements.yml

---
- src: git@git.srv:ansible/linux-http.git
  scm: git
- src: git@git.srv:ansible/apache-php.git
  scm: git

Previously, when we pushed new role updates to master, these would be overwritten in the 'ansible/roles' directory with the above command. Now, these are not updated until we manually delete the roles in that folder. We get the following output:

- linux-http is already installed, skipping.
- apache-php is already installed, skipping.

As far as I can tell, force no longer does anything as of 2.3.0

Copied from original issue: ansible/galaxy-issues#249

chouseknecht commented 7 years ago

Fixed in by Ansible PR #23391

bittner commented 5 years ago

I believe, we still have a problem with "updating" using the --force option.

We have a situation in a cluster auto-update strategy that makes a playbook fail, because an ansible-galaxy install --force runs at the same time and the playbook doesn't find the related role:

...
The offending line appears to be:

      import_role:
        name: foo-server-bootstrap
              ^ here
...

This is due to the fact that --force replaces (removes and installs) the role no matter whether the latest version of the role is already installed.

Rather than --force we'd need an --update option for install that would verify whether a new version is available for installation before brute-force proceed on doing it.

Has something like that been discussed before? Is that maybe planned already?

bittner commented 5 years ago

Related issues:

C0rn3j commented 2 years ago

I believe OP's issue been fixed at some point. Would still be nice to have the --update option.

ansible-galaxy role install -r /root/playbooks/requirements.yaml --force

Starting galaxy collection install process
Process install dependency map
Starting collection install process
'kewlfft.aur:0.10.0' is already installed, skipping.
Starting galaxy role install process
- changing role gantsign.visual-studio-code-extensions from 2.4.0 to unspecified
- downloading role 'visual-studio-code-extensions', owned by gantsign
- downloading role from https://github.com/gantsign/ansible-role-visual-studio-code-extensions/archive/2.4.0.tar.gz
- extracting gantsign.visual-studio-code-extensions to /root/.ansible/roles/gantsign.visual-studio-code-extensions
- gantsign.visual-studio-code-extensions (2.4.0) was installed successfully
- changing role geerlingguy.certbot from 4.1.0 to unspecified
- downloading role 'certbot', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-certbot/archive/5.0.0.tar.gz
- extracting geerlingguy.certbot to /root/.ansible/roles/geerlingguy.certbot
- geerlingguy.certbot (5.0.0) was installed successfully
- changing role geerlingguy.postgresql from 3.1.1 to unspecified
- downloading role 'postgresql', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-postgresql/archive/3.2.1.tar.gz
- extracting geerlingguy.postgresql to /root/.ansible/roles/geerlingguy.postgresql
- geerlingguy.postgresql (3.2.1) was installed successfully
# ansible --version     
ansible [core 2.12.1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/sbin/ansible
  python version = 3.10.1 (main, Dec 18 2021, 23:53:45) [GCC 11.1.0]
  jinja version = 3.0.3
  libyaml = True