Error when installing Bahmni 0.92 on Centos7 with ansible

Tags: #<Tag:0x00007f7514bd45d0>

Hello Community

I am trying to install Bahmni on Centos7 with ansible inventory file but I keep getting this error

   # bahmni -i inventory install
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.ufs.ac.za
     * epel: fedora-epel.mirrors.tds.net
     * extras: mirror.ufs.ac.za
     * updates: mirror.ufs.ac.za
    Package matching ansible-2.4.2.0-2.el7.noarch already installed. Checking for update.
    Nothing to do
    ansible-playbook -i /etc/bahmni-installer/inventory all.yml -vv  --extra-vars '@/etc/bahmni-installer/rpm_versions.yml' --extra-vars '@/etc/bahmni-backrest.conf' --extra-vars '@/etc/bahmni-installer/setup.yml'
    ansible-playbook 2.8.5
      config file = /opt/bahmni-installer/bahmni-playbooks/ansible.cfg
      configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python2.7/site-packages/ansible
      executable location = /bin/ansible-playbook
      python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
    Using /opt/bahmni-installer/bahmni-playbooks/ansible.cfg as config file
    [DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this will change, but still be user
    configurable on deprecation. This feature will be removed in version 2.10. Deprecation warnings can be disabled by setting deprecation_warnings=False in
    ansible.cfg.
     [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

    [DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default). This feature will be removed in version
    2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
    statically imported: /opt/bahmni-installer/bahmni-playbooks/roles/oracle-java/tasks/oracle-java.yml
    statically imported: /opt/bahmni-installer/bahmni-playbooks/roles/installer-config/tasks/installer-config.yml
    statically imported: /opt/bahmni-installer/bahmni-playbooks/roles/selinux/tasks/enforcing_policies.yml
    statically imported: /opt/bahmni-installer/bahmni-playbooks/roles/installer-config/tasks/installer-config.yml
    statically imported: /opt/bahmni-installer/bahmni-playbooks/roles/installer-config/tasks/installer-config.yml
    statically imported: /opt/bahmni-installer/bahmni-playbooks/roles/oracle-java/tasks/oracle-java.yml
    statically imported: /opt/bahmni-installer/bahmni-playbooks/roles/installer-config/tasks/installer-config.yml
    ERROR! 'always' keyword cannot be used without 'block'

    The error appears to be in '/opt/bahmni-installer/bahmni-playbooks/roles/bahmni-backup-upload-directories/tasks/main.yml': line 14, column 3, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:


    - always:
      ^ here

    Traceback (most recent call last):
      File "/bin/bahmni", line 11, in <module>
        load_entry_point('bahmni==0.1', 'console_scripts', 'bahmni')()
      File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 764, in __call__
        return self.main(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 717, in main
        rv = self.invoke(ctx)
      File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/core.py", line 555, in invoke
        return callback(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/decorators.py", line 17, in new_func
        return f(get_current_context(), *args, **kwargs)
      File "build/bdist.linux-x86_64/egg/bahmni.py", line 79, in install
      File "/usr/lib64/python2.7/subprocess.py", line 542, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'ansible-playbook -i /etc/bahmni-installer/inventory all.yml -vv  --extra-vars '@/etc/bahmni-installer/rpm_versions.yml' --extra-vars '@/etc/bahmni-backrest.conf' --extra-vars '@/etc/bahmni-installer/setup.yml'' returned non-zero exit status 4
1 Like

From your error log, its obvious that the inventory file has invalid characters. Check the log … and run the install command with -vvvv option to get more details

Thanks @angshuonline

You can see the log file here and my inventory file here

Additional logs here

I don’t know why it’s complaining about the ‘-’, I basically copied this inventory file and added the connect strings and IPs. I was editing it with notepad++

2019-10-15 13:44:34,613 p=9953 u=root |  Not replacing invalid character(s) "set([u'-'])" in group name (mysql-backup-tool)
2019-10-15 13:44:34,613 p=9953 u=root |  Not replacing invalid character(s) "set([u'-'])" in group name (mysql-backup-tool)
2019-10-15 13:44:34,614 p=9953 u=root |  Not replacing invalid character(s) "set([u'-'])" in group name (postgres-backup-tool)
2019-10-15 13:44:34,614 p=9953 u=root |  Not replacing invalid character(s) "set([u'-'])" in group name (postgres-backup-tool)
2019-10-15 13:44:34,614 p=9953 u=root |  Not replacing invalid character(s) "set([u'-'])" in group name (bahmni-backup-artifacts)
2019-10-15 13:44:34,615 p=9953 u=root |  Not replacing invalid character(s) "set([u'-'])" in group name (bahmni-backup-artifacts)

downgrade ansible and install: wget https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.6.0-1.el7.ans.noarch.rpm . This will solve the issue.

Thanks @deepakneupane. I downgraded ansible but still nothing got installed

# ansible --version
ansible 2.4.6.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

# yum list installed | grep bahmni
bahmni-installer.noarch               0.93-2                          @bahmni

Here’s a trace of the log file

#tail -100 /var/log/bahmni-installer/bahmni-installer.log
2019-10-16 08:56:14,488 p=3793 u=root |  task path: /opt/bahmni-installer/bahmni-playbooks/roles/mysql/tasks/main.yml:49
2019-10-16 08:56:14,509 p=3793 u=root |  Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
2019-10-16 08:56:14,736 p=3793 u=root |  changed: [10.*.*.*] => {
    "changed": true,
    "cmd": "grep 'temporary password' /var/log/mysqld.log | awk '{print $11}'",
    "delta": "0:00:00.003549",
    "end": "2019-10-16 08:56:14.721593",
    "failed": false,
    "invocation": {
        "module_args": {
            "_raw_params": "grep 'temporary password' /var/log/mysqld.log | awk '{print $11}'",
            "_uses_shell": true,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "warn": true
        }
    },
    "rc": 0,
    "start": "2019-10-16 08:56:14.718044",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "CKw5dr,>/Sah\n*))<l6cCtme1",
    "stdout_lines": [
        "CKw5dr,>/Sah",
        "*))<l6cCtme1"
    ]
}
2019-10-16 08:56:14,741 p=3793 u=root |  TASK [mysql : Update mysql root password with temp password] ******************************************************************************************************
2019-10-16 08:56:14,742 p=3793 u=root |  task path: /opt/bahmni-installer/bahmni-playbooks/roles/mysql/tasks/main.yml:54
2019-10-16 08:56:14,769 p=3793 u=root |  Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
2019-10-16 08:56:15,008 p=3793 u=root |  fatal: [10.*.*.*]: FAILED! => {
    "changed": true,
    "cmd": "mysql -e \"SET PASSWORD = PASSWORD('********'); FLUSH PRIVILEGES;\" --connect-expired-password -u root -i -p'CKw5dr,>/Sah\n*))<l6cCtme1'",
    "delta": "0:00:00.007649",
    "end": "2019-10-16 08:56:14.992675",
    "failed": true,
    "invocation": {
        "module_args": {
            "_raw_params": "mysql -e \"SET PASSWORD = PASSWORD('********'); FLUSH PRIVILEGES;\" --connect-expired-password -u root -i -p'CKw5dr,>/Sah\n*))<l6cCtme1'",
            "_uses_shell": true,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "warn": true
        }
    },
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2019-10-16 08:56:14.985026",
    "stderr": "mysql: [Warning] Using a password on the command line interface can be insecure.\nERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)",
    "stderr_lines": [
        "mysql: [Warning] Using a password on the command line interface can be insecure.",
        "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)"
    ],
    "stdout": "",
    "stdout_lines": []
}
2019-10-16 08:56:15,008 p=3793 u=root |  ...ignoring
2019-10-16 08:56:15,013 p=3793 u=root |  TASK [mysql : Update mysql root password] *************************************************************************************************************************
2019-10-16 08:56:15,013 p=3793 u=root |  task path: /opt/bahmni-installer/bahmni-playbooks/roles/mysql/tasks/main.yml:60
2019-10-16 08:56:15,077 p=3793 u=root |  Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
2019-10-16 08:56:15,293 p=3793 u=root |  fatal: [10.*.*.*]: FAILED! => {
    "changed": true,
    "cmd": "mysql -e \"UPDATE mysql.user SET authentication_string=PASSWORD('********') WHERE User='root'; FLUSH PRIVILEGES;\" -u root -i -p'********'",
    "delta": "0:00:00.006257",
    "end": "2019-10-16 08:56:15.280677",
    "failed": true,
    "invocation": {
        "module_args": {
            "_raw_params": "mysql -e \"UPDATE mysql.user SET authentication_string=PASSWORD('********') WHERE User='root'; FLUSH PRIVILEGES;\" -u root -i -p'********'",
            "_uses_shell": true,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "warn": true
        }
    },
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2019-10-16 08:56:15.274420",
    "stderr": "mysql: [Warning] Using a password on the command line interface can be insecure.\nERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)",
    "stderr_lines": [
        "mysql: [Warning] Using a password on the command line interface can be insecure.",
        "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)"
    ],
    "stdout": "",
    "stdout_lines": []
}
2019-10-16 08:56:15,294 p=3793 u=root |         to retry, use: --limit @/opt/bahmni-installer/bahmni-playbooks/all.retry

2019-10-16 08:56:15,294 p=3793 u=root |  PLAY RECAP ********************************************************************************************************************************************************
2019-10-16 08:56:15,295 p=3793 u=root |  10.*.*.*                : ok=69   changed=36   unreachable=0    failed=1
2019-10-16 08:56:15,295 p=3793 u=root |  10.*.*.*                : ok=56   changed=19   unreachable=0    failed=0

Why did you have to install Ansible? Bahmni installer will fetch and install required ansible version.

What machine are you using? CentOS7 has various distro. Can you try with barebone minimal distro?

As indicated in the other thread, check a similar thread that I linked.

You need to ensure that ansible can access and provision both the systems. In most cases, people tend to overlook that from the control machine ansible uses the mentioned user to ssh to the other machine and install softwares. So, before you proceed with Bahmni, check if you can do simple things on the remote machines. (like write a file on both machines). Check the other thread for pointers.

Try deleting mysqld log

rm /var/log/mysqld.log and reinstall. One of the tasks copies MySQL temporary password from /var/log/mysqld.log - if you reinstalled MySQL couple of times [ by running bahmni-installer couple of times] , the log will store multiple temporary passwords and we won’t know if we picking current password from the log.

  1. I have uninstalled everything and tried re-installing

  2. Here’s the distro version

     # cat /etc/centos-release
     CentOS Linux release 7.6.1810 (Core)
    
     # cat /etc/os-release
     NAME="CentOS Linux"
     VERSION="7 (Core)"
     ID="centos"
     ID_LIKE="rhel fedora"
     VERSION_ID="7"
     PRETTY_NAME="CentOS Linux 7 (Core)"
     ANSI_COLOR="0;31"
     CPE_NAME="cpe:/o:centos:centos:7"
     HOME_URL="https://www.centos.org/"
     BUG_REPORT_URL="https://bugs.centos.org/"
    
     CENTOS_MANTISBT_PROJECT="CentOS-7"
     CENTOS_MANTISBT_PROJECT_VERSION="7"
     REDHAT_SUPPORT_PRODUCT="centos"
     REDHAT_SUPPORT_PRODUCT_VERSION="7"
    
  3. SSH is working fine, even ansible ping returns success

     # ansible -m ping all
     10.*.*.* | SUCCESS => {
         "changed": false,
         "ping": "pong"
     }
     10.*.*.* | SUCCESS => {
         "changed": false,
         "ping": "pong"
     }

Thanks @bhiravabhatla for your reply

I did as you advised but I got this error now

 fatal: [10.*.*.*]: FAILED! => {
    "changed": false,
    "module_stderr": "OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 15108\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 10.*.*.* closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_JyTWeq/ansible_module_mysql_user.py\", line 218, in <module>\r\n    from ansible.module_utils.basic import AnsibleModule\r\nzlib.error: Error -2 while preparing to decompress data: inconsistent stream state\r\n",
    "msg": "MODULE FAILURE",
    "rc": 0
}
1 Like

Where did you get the CentOS 7.6 installer from?

https://wiki.centos.org/Download Start with minimal (thats all you need) - you can find minimal ISO images here.

1 Like

It was installed by our sysadmins. Are you suggesting that the problem I am facing is caused by the installed distribution? Why isn’t this specified in the System Requirements page?

This is a recently reported issue, for which we have a work around for now. Refer to Error in installing bahmni 0.92 in vagrant box and

We should have a permanent solution soon

I keep receiving error after error, I managed to install zlib 1.2.11

yum list installed | grep zlib
zlib.x86_64                           1.2.7-18.el7                    @anaconda

But now I get this new error

fatal: [10.*.*.*]: FAILED! => {
    "changed": false,
    "module_stderr": "OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 29624\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 10.*.*.* closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_s5f3lf/ansible_module_mysql_user.py\", line 218, in <module>\r\n    from ansible.module_utils.basic import AnsibleModule\r\nzlib.error: Error -2 while preparing to decompress data: inconsistent stream state\r\n",
    "msg": "MODULE FAILURE",
    "rc": 0
}

Hi @tapologo,

I could see that zlib is still at 1.2.7 version from your screenshot. You could follow steps mentioned below link to install zlib 1.2.11 and retry installing bahmni

Oh sorry, missed that. I fixed it now and the version is

zlib.x86_64 1.2.11-18.fc30 @/zlib-1.2.11-18.fc30.x86_64

But I am still getting the error mentioned above eve after this

If you are doing this on master slave setup or multiple machines. You would want to repeat above step in all the machines.

Basically on the machine where the mysql is being installed - this update would be required.