Closed dlundgren closed 9 months ago
@dlundgren Thanks for reporting this issue. We have created a ticket internally to track this issue. We will update you once we fix this issue . Thanks !!
Debian default shell doesn't support the pipefail option, which is mandatory according to ansible-lint
1.
To resolve add this to your ansible.cfg
:
[defaults]
executable = /bin/bash
Believe I am having the same / similar issue:
TASK [jfrog.platform.artifactory : Check artifactory version] ********************************************************************************************************************************************************* task path: /opt/repo/provisioning/collections/ansible_collections/jfrog/platform/roles/artifactory/tasks/upgrade.yml:59 fatal: [server.domain.com]: FAILED! => {"changed": false, "cmd": "set -o pipefail;\ngrep artifactory.product.version \"/opt/jfrog/artifactory/app/artifactory.product.version.properties\" |cut -d= -f2\n", "delta": "0:00:00.005347", "end": "2024-02-06 14:41:13.110843", "msg": "non-zero return code", "rc": 2, "start": "2024-02-06 14:41:13.105496", "stderr": "grep: /opt/jfrog/artifactory/app/artifactory.product.version.properties: No such file or directory", "stderr_lines": ["grep: /opt/jfrog/artifactory/app/artifactory.product.version.properties: No such file or directory"], "stdout": "", "stdout_lines": []}
That the above file isn't in /opt/jfrog/artifactory/app/artifactory.product.version.properties
But in ; /opt/jfrog/artifactory-pro-7.77.3/app/artifactory.product.version.properties
However artifactory home is set to :
jfrog_home_directory: /opt/jfrog artifactory_home: "{{ jfrog_home_directory }}/artifactory" artifactory_home: /opt/jfrog/artifactory ;
not :
artifactory_home: "{{ jfrog_home_directory }}/artifactory-{{ artifactory_flavour }}-{{ artifactory_version }}" artifactory_home: /opt/jfrog/artifactory-pro-7.77.3
So not sure how this task is supposed to work?
Is there a workaround?
There is this file that ansible did create on install with version info;
[root@server info]# cat installer-info.json #
# { "productId": "Ansible_Artifactory/10.17.0-7.19.4", "features": [ { "featureId": "Channel/galaxy" } ] }[root@server info]# pwd /opt/jfrog/artifactory/var/etc/artifactory/info
There is this file that annsible did create on install with version info;
[root@server info]# cat installer-info.json
#
# Ansible managed
#
{
"productId": "Ansible_Artifactory/10.17.0-7.19.4",
"features": [
{
"featureId": "Channel/galaxy"
}
]
}[root@server info]# pwd
/opt/jfrog/artifactory/var/etc/artifactory/info
Above was from this task ;
./roles/artifactory/tasks/main.yml: line 144 - 150
Can this file be used instead and updated with the installer-info.json.j2 or a template to keep it up to date when you upgrade?
Would you know ; @dlundgren ?
Your issue is different as it's trying to locate a file that is in a different place from the default.
In your case, by setting artifactory_home: "{{ jfrog_home_directory }}/artifactory-{{ artifactory_flavour }}-{{ artifactory_version }}"
you have a moving target, and it will never be able to find the currently installed file. This is due to the fact that artifactory_version
changes with each release of the collection.
I would delete artifactory_home
from where it was defined (host/group/global) outside of the collection, and then you'll have to manually move the /opt/jfrog/artifactory-pro-{{ installed_version }}
to /opt/jfrog/artifactory
. You may need to edit the configuration files to point them to the right path as well, I'm not sure. This will allow future upgrades to be easier.
No, I am not setting it to :
artifactory_home: "{{ jfrog_home_directory }}/artifactory-{{ artifactory_flavour }}-{{ artifactory_version }}"
I have it set to the default: aka :
artifactory_home: "{{ jfrog_home_directory }}/artifactory"
However, that's where I found that specific file name.
aka under; /opt/jfrog/artifactory-pro-7.77.3/app/artifactory.product.version.properties
I mean why isn't it looking for :
name: Configure installer info become: true ansible.builtin.template: src: installer-info.json.j2 dest: "{{ artifactory_home }}/var/etc/artifactory/info/installer-info.json" mode: 0644 notify: Restart artifactory
vs what it is looking at?
name: Check artifactory version ansible.builtin.shell: | set -o pipefail; grep artifactory.product.version "{{ artifactory_home }}/app/artifactory.product.version.properties" |cut -d= -f2 register: check_version_cmd changed_when: false
I can't answer why the role doesn't look at installer-info.json
for the currently installed version, to me it makes sense to look at the actual app properties that are installed.
I can say that the /opt/jfrog/artifactory-pro-7.77.3
folder is where the Artifactory archive is untar'd to, before the app is moved to /opt/jfrog/artifactory
.
This leads me to believe that your installation failed, or this collection/role wasn't used to install Artifactory, and it's installed manually in another folder.
At which point the upgrade tasks probably won't work properly, as /opt/jfrog/artifactory
does not contain the actual application. I would try running the install process again so that Artifactory is in the correct location.
True, I guess that is the answer, it makes more sense to look at the actual app properties.
Right ok, so it copies the extract into ./artifactory
[root@server jfrog]# pwd /opt/jfrog [root@server jfrog]# ll total 2043884 drwxr-xr-x. 4 artifactory artifactory 157 Feb 2 16:50 artifactory drwxr-xr-x 4 artifactory artifactory 28 May 21 2021 artifactory-pro-7.19.4 drwxr-xr-x 4 artifactory artifactory 28 Jan 23 15:44 artifactory-pro-7.77.3 -rw-r--r-- 1 artifactory artifactory 497144409 Feb 1 15:31 jfrog-artifactory-pro-7.19.4-linux.tar.gz -rw-r--r-- 1 artifactory artifactory 1595786359 Feb 6 13:45 jfrog-artifactory-pro-7.77.3-linux.tar.gz
I see that now with this task.
and there are folders/files in there:
cd /opt/jfrog/artifactory/app [root@server app]# ll total 4 drwxr-xr-x 3 artifactory artifactory 20 May 21 2021 artifactory drwxr-xr-x 3 artifactory artifactory 4096 Feb 2 16:37 bin drwxr-xr-x 2 artifactory artifactory 225 Feb 1 15:32 doc drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 event drwxr-xr-x 3 artifactory artifactory 17 Feb 2 21:46 frontend drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 metadata drwxr-xr-x 6 artifactory artifactory 95 Feb 1 15:31 misc drwxr-xr-x 4 artifactory artifactory 28 May 21 2021 replicator drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 router drwxr-xr-x 2 artifactory artifactory 6 Feb 6 13:46 run drwxr-xr-x 8 artifactory artifactory 88 May 21 2021 third-party
but not this file which is strange; artifactory.product.version.properties
/opt/jfrog/artifactory-pro-7.77.3/app [root@server app]# ll total 12 drwxr-xr-x 3 artifactory artifactory 20 Jan 23 15:44 artifactory -rwxr-xr-x 1 artifactory artifactory 174 Jan 23 15:18 artifactory.product.version.properties drwxr-xr-x 3 artifactory artifactory 4096 Feb 6 13:46 bin drwxr-xr-x 2 artifactory artifactory 4096 Feb 6 13:46 doc drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 event drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 frontend drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:21 jfconnect drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 metadata drwxr-xr-x 6 artifactory artifactory 95 Feb 6 13:46 misc drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 observability drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:21 replicator drwxr-xr-x 3 artifactory artifactory 17 Jan 23 15:44 router drwxr-xr-x 4 artifactory artifactory 28 Jan 23 15:44 rtfs drwxr-xr-x 8 artifactory artifactory 88 Jan 23 15:44 third-party
OOOOH. well, this may answer the above question;
I installed 7.19.4 as that was the current version that we are running on another host. I'm taking the MySQL db and exporting it, importing it into this new server, and doing a rsync of the filestore over to the new box also. I was thinking it would be better to do the same version for that first migration, then I would upgrade the version which is why you see the 2 versions above. However, the first version which is what I used for the initial install does not have the artifactory.product.version.properties as part of the *.tar extract. So I wonder when that got added. And If I could copy just that file in then? Or should I just install the latest version instead of trying to install the old version first and then upgrading?
[root@server app]# pwd /opt/jfrog/artifactory-pro-7.19.4/app [root@server app]# ls -al total 4 drwxr-xr-x 12 artifactory artifactory 155 Feb 1 15:32 . drwxr-xr-x 4 artifactory artifactory 28 May 21 2021 .. drwxr-xr-x 3 artifactory artifactory 20 May 21 2021 artifactory drwxr-xr-x 3 artifactory artifactory 4096 Feb 1 15:31 bin drwxr-xr-x 2 artifactory artifactory 225 Feb 1 15:32 doc drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 event drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 frontend drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 metadata drwxr-xr-x 6 artifactory artifactory 95 Feb 1 15:31 misc drwxr-xr-x 4 artifactory artifactory 28 May 21 2021 replicator drwxr-xr-x 3 artifactory artifactory 17 May 21 2021 router drwxr-xr-x 8 artifactory artifactory 88 May 21 2021 third-party
Seems like a lot of work to go back to every previous release to make sure that file is there. A quicker option is if that file is not there perhaps look for the installer-info.json file that was created with older versions.
I was able to work around the issue by copying the artifactory.product.version.properties file from the newer build and then editing it to contain the older version information.
Moving what I found to a new issue.
Fixed via #375
Is this a request for help?:
No, I solved it locally by removing
set -o pipefail;
and running the role again.Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG REPORT
Which installer:
Ansible role/artifactory
Which product and version (eg: ansible & collection version - 7.24.2):
Collection version 10.16.4
Which operating system and version(eg: ubuntu & version - 20.4):
Ubuntu 22.04
Which product license (Enterprise/Pro):
Pro
JFrog support reference (if already raised with support team):
N/A
What happened:
What you expected to happen:
That the role upgraded Artifactory.
How to reproduce it (as minimally and precisely as possible):
Run the role against Ubuntu 22.04 (after having Artifactory already installed) and use the following variables