Is this a request for help?:
No
Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG REPORT
Which installer:
Ansible; collection 1.1.2 (latest)
Which product and version:
Artifactory 7.12.5
Verified (and reproduced the same way) also on 7.10.2 which is listed as certified in README.md
OS: Ubuntu 18.04
What happened:
Ansible fails at jfrog.installers.artifactory : create artifactory service
task:
... REDACTED FOR BREVITY...
TASK [jfrog.installers.postgres : install postgres configuration] **************
[WARNING]: Using world-readable permissions for temporary files Ansible needs
to create when becoming an unprivileged user. This may be insecure. For
information on securing this, see
https://docs.ansible.com/ansible/user_guide/become.html#risks-of-becoming-an-
unprivileged-user
changed: [artifactory.ourdomain.io] => (item=pg_hba.conf)
changed: [artifactory.ourdomain.io] => (item=postgresql.conf)
TASK [jfrog.installers.postgres : enable postgres service] *********************
ok: [artifactory.ourdomain.io]
TASK [jfrog.installers.postgres : Hold until Postgresql is up and running] *****
ok: [artifactory.ourdomain.io]
TASK [jfrog.installers.postgres : Create users] ********************************
[WARNING]: Using world-readable permissions for temporary files Ansible needs
to create when becoming an unprivileged user. This may be insecure. For
information on securing this, see
https://docs.ansible.com/ansible/user_guide/become.html#risks-of-becoming-an-
unprivileged-user
changed: [artifactory.ourdomain.io] => (item=None)
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.postgres : Create a database] ***************************
TASK [jfrog.installers.postgres : Grant privs on db] ***************************
TASK [jfrog.installers.postgres : restart postgres] ****************************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.postgres : debug] ***************************************
ok: [artifactory.ourdomain.io] => {
"msg": "Restarted postgres service [email protected]"
}
TASK [include_role : jfrog.installers.artifactory] *****************************
TASK [jfrog.installers.artifactory : Check to see if artifactory has a service and stop it] ***
fatal: [artifactory.ourdomain.io]: FAILED! => {"changed": false, "msg": "Could not find the requested service artifactory: host"}
TASK [jfrog.installers.artifactory : Check to see if artifactory has a service and stop it] ***
fatal: [artifactory.ourdomain.io]: FAILED! => {"changed": false, "msg": "Could not find the requested service artifactory: host"}
TASK [jfrog.installers.artifactory : perform installation] *********************
included: /Users/waldekm/git/auto/galaxy-roles/ansible_collections/jfrog/installers/roles/artifactory/tasks/install.yml for artifactory.ourdomain.io
TASK [jfrog.installers.artifactory : debug] ************************************
ok: [artifactory.ourdomain.io] => {
"msg": "Performing installation of Artifactory..."
}
TASK [install nginx] ***********************************************************
TASK [jfrog.installers.artifactory_nginx : debug] ******************************
ok: [artifactory.ourdomain.io] => {
"msg": "Attempting nginx installation without dependencies for potential offline mode."
}
TASK [jfrog.installers.artifactory_nginx : install nginx without dependencies] ***
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory_nginx : configure main nginx conf file.] ****
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory_nginx : configure the artifactory nginx conf] ***
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory_nginx : restart nginx] **********************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : create group for artifactory] *************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : create user for artifactory] **************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : ensure jfrog_home_directory exists] *******
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : Local Copy artifactory] *******************
skipping: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : download artifactory] *********************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : Create artifactory home folder] ***********
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : Create Symlinks for var folder] ***********
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : Create Symlinks for app folder] ***********
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : ensure artifactory_file_store_dir exists] ***
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : ensure data exists] ***********************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : ensure etc exists] ************************
ok: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : use specified system yaml] ****************
skipping: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : configure system yaml template] ***********
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : ensure /opt/jfrog/artifactory/var/etc/security/ exists] ***
ok: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : configure master key] *********************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : configure join key] ***********************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : ensure /opt/jfrog/artifactory/var/etc/artifactory/info/ exists] ***
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : configure installer info] *****************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : use specified binary store] ***************
skipping: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : use default binary store] *****************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : use license file] *************************
skipping: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : use license strings] **********************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : Copy local database driver] ***************
skipping: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : download database driver] *****************
changed: [artifactory.ourdomain.io]
TASK [jfrog.installers.artifactory : create artifactory service] ***************
fatal: [artifactory.ourdomain.io]: FAILED! => {"changed": true, "cmd": "/opt/jfrog/artifactory/app/bin/installService.sh", "delta": "0:00:01.104974", "end": "2021-01-07 11:25:17.556423", "msg": "non-zero return code", "rc": 1, "start": "2021-01-07 11:25:16.451449", "stderr": "", "stderr_lines": [], "stdout": "\nInstalling artifactory as a Unix service that will run as user artifactory and group artifactory\nInstalling artifactory with home /opt/jfrog/artifactory/app\nCreating user artifactory...already exists... DONE\nCreating Group artifactory...already exists... DONE\nModifying environment file /opt/jfrog/artifactory/app/bin/artifactory.default... DONE\n\u001b[33m** INFO: Please create/edit system.yaml file in /opt/jfrog/artifactory/var/etc to set the correct environment\u001b[0m\n\u001b[33m Templates with information can be found in the same directory\u001b[0m\nInitializing artifactory.service service with systemctl... DONE\nRemoving old custom drivers : /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_*\nCopying /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib/postgresql-42.2.18.jar to /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_postgresql-42.2.18.jar\nCopying /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib/README.md to /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_README.md\n\nSetting file permissions...\nChecking permissions on /opt/jfrog/artifactory/var\n/opt/jfrog/artifactory/var is already owned by artifactory:artifactory.\n\u001b[38;5;197m[ERROR\u001b[0m\u001b[38;5;197m] \u001b[0mFailed to set create shared.user with artifactory in /opt/jfrog/artifactory/var/etc/system.yaml, \\ncommand used : /opt/jfrog/artifactory/app/bin/../third-party/yq/yq w -i \"/opt/jfrog/artifactory/var/etc/system.yaml\" \"shared.user\" \"artifactory\"", "stdout_lines": ["", "Installing artifactory as a Unix service that will run as user artifactory and group artifactory", "Installing artifactory with home /opt/jfrog/artifactory/app", "Creating user artifactory...already exists... DONE", "Creating Group artifactory...already exists... DONE", "Modifying environment file /opt/jfrog/artifactory/app/bin/artifactory.default... DONE", "\u001b[33m** INFO: Please create/edit system.yaml file in /opt/jfrog/artifactory/var/etc to set the correct environment\u001b[0m", "\u001b[33m Templates with information can be found in the same directory\u001b[0m", "Initializing artifactory.service service with systemctl... DONE", "Removing old custom drivers : /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_*", "Copying /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib/postgresql-42.2.18.jar to /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_postgresql-42.2.18.jar", "Copying /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib/README.md to /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_README.md", "", "Setting file permissions...", "Checking permissions on /opt/jfrog/artifactory/var", "/opt/jfrog/artifactory/var is already owned by artifactory:artifactory.", "\u001b[38;5;197m[ERROR\u001b[0m\u001b[38;5;197m] \u001b[0mFailed to set create shared.user with artifactory in /opt/jfrog/artifactory/var/etc/system.yaml, \\ncommand used : /opt/jfrog/artifactory/app/bin/../third-party/yq/yq w -i \"/opt/jfrog/artifactory/var/etc/system.yaml\" \"shared.user\" \"artifactory\""]}
PLAY RECAP *********************************************************************
artifactory.ourdomain.io : ok=50 changed=31 unreachable=0 failed=2 skipped=51 rescued=1 ignored=0
What you expected to happen:
Ansible succesfully installing the unit file and moving on with installation.
How to reproduce it (as minimally and precisely as possible):
Standard playbook based on
https://github.com/jfrog/JFrog-Cloud-Installers/blob/master/Ansible/examples/playbook-rt.yml
Ran against a Ubuntu 18.04.5 LTS VM.
- name: Install and configure Artifactory
hosts: artifactory_test
become: true
tasks:
- include_role:
name: jfrog.installers.postgres
- include_role:
name: jfrog.installers.artifactory
Additional group vars (in artifactory_test.yml
)
# postgres role:
db_users:
- db_user: "artifactory"
db_password: "mypassword"
# artifactory role:
server_name: "{{ ansible_fqdn }}"
artifactory_version: 7.10.2
artifactory_is_primary: true
db_download_url: "https://jdbc.postgresql.org/download/postgresql-42.2.18.jar"
db_type: "postgresql"
db_driver: "org.postgresql.Driver"
db_url: "jdbc:postgresql://localhost:5432/artifactory"
db_user: "artifactory"
db_password: "mypassword"
Anything else we need to know:
I did some investigation and looking at this task:
|
shell: "{{ artifactory_home }}/app/bin/installService.sh" |
has shown me it's running /opt/jfrog/artifactory/app/bin/installService.sh
script.
I executed it manually and the output is as follows:
root@artifactory:/opt/jfrog/artifactory/app/bin# ./installService.sh
Installing artifactory as a Unix service that will run as user artifactory and group artifactory
Installing artifactory with home /opt/jfrog/artifactory/app
Creating user artifactory...already exists... DONE
Creating Group artifactory...already exists... DONE
Modifying environment file /opt/jfrog/artifactory/app/bin/artifactory.default... DONE
** INFO: Please create/edit system.yaml file in /opt/jfrog/artifactory/var/etc to set the correct environment
Templates with information can be found in the same directory
Stopping the artifactory service...
Initializing artifactory.service service with systemctl... DONE
Removing old custom drivers : /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_postgresql-42.2.18.jar /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_README.md
Copying /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib/postgresql-42.2.18.jar to /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_postgresql-42.2.18.jar
Copying /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib/README.md to /opt/jfrog/artifactory/app/artifactory/tomcat/lib/jf_README.md
Setting file permissions...
Checking permissions on /opt/jfrog/artifactory/var
/opt/jfrog/artifactory/var is already owned by artifactory:artifactory.
[ERROR] Failed to set create shared.user with artifactory in /opt/jfrog/artifactory/var/etc/system.yaml, \ncommand used : /opt/jfrog/artifactory/app/bin/../third-party/yq/yq w -i "/opt/jfrog/artifactory/var/etc/system.yaml" "shared.user" "artifactory"
root@artifactory:/opt/jfrog/artifactory/app/bin#
Content of this file afterwards is:
root@artifactory:/opt/jfrog/artifactory/app/bin# ls -al /opt/jfrog/artifactory/var/etc/system.yaml
-rw-r--r-- 1 root root 1314 Jan 7 11:25 /opt/jfrog/artifactory/var/etc/system.yaml
root@artifactory:/opt/jfrog/artifactory/app/bin# cat /opt/jfrog/artifactory/var/etc/system.yaml
## @formatter:off
## JFROG ARTIFACTORY SYSTEM CONFIGURATION FILE
## HOW TO USE: comment-out any field and keep the correct yaml indentation by deleting only the leading '#' character.
configVersion: 1
## NOTE: JFROG_HOME is a place holder for the JFrog root directory containing the deployed product, the home directory for all JFrog products.
## Replace JFROG_HOME with the real path! For example, in RPM install, JFROG_HOME=/opt/jfrog
## NOTE: Sensitive information such as passwords and join key are encrypted on first read.
## NOTE: The provided commented key and value is the default.
## SHARED CONFIGURATIONS
## A shared section for keys across all services in this config
shared:
## Node Settings
node:
## A unique id to identify this node.
## Default: auto generated at startup.
id: c679d8c16d38498c9598c8e8c84ba759
## Sets this node as primary in HA installation
primary: True
## Sets this node as part of HA installation
haEnabled: True
## Database Configuration
database:
## One of: mysql, oracle, mssql, postgresql, mariadb
## Default: Embedded derby
## Example for mysql/postgresql
type: "postgresql"
driver: "org.postgresql.Driver"
url: "jdbc:postgresql://localhost:5432/artifactory"
username: "artifactory"
password: "mypassword"
Note the invalid indentation of the lines driver
and password
in the Yaml file.