StackStorm / ansible-st2

Ansible Roles and Playbooks to deploy StackStorm
https://galaxy.ansible.com/StackStorm/stackstorm/
Apache License 2.0
100 stars 75 forks source link

Installation failed on RH 7 - st2chatops service not found #262

Closed dove-young closed 1 year ago

dove-young commented 4 years ago

Here is my installation command

ANSIBLE_FORCE_COLOR=true ansible-playbook stackstorm.yml -i ./hosts  -vvv 2>&1 | tee install-2.log

Ansible-ST2 HEAD is

commit 97108985f3351d696d3413f2db3cf3d43eb43a89
Merge: 86a1cec 35abf1d
Author: JP Bourget <jp.bourget@gmail.com>
Date:   Tue Apr 14 13:40:42 2020 -0400

    Merge pull request #258 from StackStorm/custom_nginx

    Custom nginx

And installation failed at here

TASK [StackStorm.st2chatops : Check if any adapter is enabled] *******************************************************************************************************************************************
task path: /root/ansible-st2/roles/StackStorm.st2chatops/tasks/main.yml:123
  fatal: [my-ip-addr]: FAILED! => {
    "changed": false,
    "cmd": [
        "grep",
        "-e",
        "^export HUBOT_ADAPTER=",
        "/opt/stackstorm/chatops/st2chatops.env"
    ],
    "delta": "0:00:00.008895",
    "end": "2020-06-23 19:03:40.050882",
    "invocation": {
        "module_args": {
            "_raw_params": "grep -e '^export HUBOT_ADAPTER=' /opt/stackstorm/chatops/st2chatops.env",
            "_uses_shell": false,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2020-06-23 19:03:40.041987",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "",
    "stdout_lines": []
}
...ignoring

TASK [StackStorm.st2chatops : Set variable enabled_adapter] **********************************************************************************************************************************************
task path: /root/ansible-st2/roles/StackStorm.st2chatops/tasks/main.yml:130
fatal: [my-ip-addr]: FAILED! => {
    "msg": "The task includes an option with an undefined variable. The error was: list object has no element 1\n\nThe error appears to be in '/root/ansible-st2/roles/StackStorm.st2chatops/tasks/main.ym
l': line 130, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set variable enabled_adapter\n  ^ here\n"
}
...ignoring
TASK [StackStorm.st2chatops : Ensure st2chatops service is enabled and running] **************************************************************************************************************************
task path: /root/ansible-st2/roles/StackStorm.st2chatops/tasks/main.yml:201
fatal: [my-ip-addr]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "daemon_reexec": false,
            "daemon_reload": false,
            "enabled": true,
            "force": null,
            "masked": null,
            "name": "st2chatops",
            "no_block": false,
            "scope": null,
            "state": null,
            "user": null
        }
    },
    "msg": "Could not find the requested service st2chatops: host"
}

RUNNING HANDLER [StackStorm.nginx : restart nginx] *******************************************************************************************************************************************************
task path: /root/ansible-st2/roles/StackStorm.nginx/handlers/main.yml:2

RUNNING HANDLER [StackStorm.st2chatops : restart st2chatops] *********************************************************************************************************************************************
task path: /root/ansible-st2/roles/StackStorm.st2chatops/handlers/main.yml:2

PLAY RECAP ***********************************************************************************************************************************************************************************************
my-ip-addr                : ok=77   changed=42   unreachable=0    failed=1    skipped=21   rescued=0    ignored=2

Here is systemctl list-units result

  st2actionrunner.service                                           loaded    active exited    StackStorm service st2actionrunner
  st2actionrunner@1.service                                         loaded    active running   StackStorm service st2actionrunner
  st2actionrunner@10.service                                        loaded    active running   StackStorm service st2actionrunner
  st2actionrunner@2.service                                         loaded    active running   StackStorm service st2actionrunner
  st2actionrunner@3.service                                         loaded    active running   StackStorm service st2actionrunner
  st2actionrunner@4.service                                         loaded    active running   StackStorm service st2actionrunner
  st2actionrunner@5.service                                         loaded    active running   StackStorm service st2actionrunner
  st2actionrunner@6.service                                         loaded    active running   StackStorm service st2actionrunner
  st2actionrunner@7.service                                         loaded    active running   StackStorm service st2actionrunner
  st2actionrunner@8.service                                         loaded    active running   StackStorm service st2actionrunner
  st2actionrunner@9.service                                         loaded    active running   StackStorm service st2actionrunner
  st2api.service                                                    loaded    active running   StackStorm service st2api
  st2auth.service                                                   loaded    active running   StackStorm service st2auth
  st2garbagecollector.service                                       loaded    active running   StackStorm service st2garbagecollector
  st2notifier.service                                               loaded    active running   StackStorm service st2notifier
  st2resultstracker.service                                         loaded    active running   StackStorm service st2resultstracker
  st2rulesengine.service                                            loaded    active running   StackStorm service st2rulesengine
  st2scheduler.service                                              loaded    active running   StackStorm service st2scheduler
  st2sensorcontainer.service                                        loaded    active running   StackStorm service st2sensorcontainer
  st2stream.service                                                 loaded    active running   StackStorm service st2stream
  st2timersengine.service                                           loaded    active running   StackStorm service st2timersengine
  st2workflowengine.service                                         loaded    active running   StackStorm service st2workflowengine

Here is yum list installed | grep st2 result

[root@ ansible-st2]# yum list installed | grep st2
st2.x86_64                          3.2.0-4                    @StackStorm_stable
st2chatops.x86_64                   3.2.0-2                    @StackStorm_stable
st2web.x86_64                       3.2.0-2                    @StackStorm_stable
[root@ ansible-st2]#
dove-young commented 4 years ago

st2chatops version is

yum info st2chatops
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Installed Packages
Name        : st2chatops
Arch        : x86_64
Version     : 3.2.0
Release     : 2
Size        : 172 M
Repo        : installed
From repo   : StackStorm_stable
Summary     : St2Chatops - StackStorm ChatOps
URL         : https://github.com/stackstorm/st2chatops
License     : Apache 2.0
Description :   Package providing StackStorm ChatOps functionality: bundled, tested and ready to use Hubot
            :   with hubot-stackstorm plugin and additional chat adapters
dove-young commented 4 years ago

I update my ansible-st2 to the latest, and the failure is the same.

commit 329660b6bb80a2a6cbaf33376c219c525cef2335
Merge: 9710898 c379542
Author: Eugen C <armab@users.noreply.github.com>
Date:   Thu Jun 18 21:03:11 2020 +0100

    Merge pull request #261 from amanda11/master

    Ansible-playbooks to install on Centos8
dove-young commented 4 years ago

I found it . It comes after a systemctl daemon-reload

[root@agentavtone-worker2 ansible-st2]# vim /usr/lib/systemd/system/st2chatops.service
[root@agentavtone-worker2 ansible-st2]# systemctl daemon-reload

[root@agentavtone-worker2 ansible-st2]# systemctl status st2chatops
● st2chatops.service - StackStorm service st2chatops
   Loaded: loaded (/usr/lib/systemd/system/st2chatops.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Sun 2020-06-21 22:19:49 PDT; 1 day 22h ago
 Main PID: 16372 (code=exited, status=0/SUCCESS)

Jun 21 22:19:16 agentavtone-worker2.fyre.ibm.com hubot[16372]: debug: RTMClient initialized
Jun 21 22:19:16 agentavtone-worker2.fyre.ibm.com hubot[16372]: [Sun Jun 21 2020 22:19:16 GMT-0700 (Pacific Daylight Time)] DEBUG RtmClient initialized with options: {"retryConfig":{"retrie...urrency":1}
Jun 21 22:19:16 agentavtone-worker2.fyre.ibm.com hubot[16372]: [Sun Jun 21 2020 22:19:16 GMT-0700 (Pacific Daylight Time)] DEBUG RtmClient#start() with options: {"mpim_aware":true}
Jun 21 22:19:16 agentavtone-worker2.fyre.ibm.com hubot[16372]: verbose: Attempting to connect via the RTM API
Jun 21 22:19:16 agentavtone-worker2.fyre.ibm.com hubot[16372]: debug: BaseAPIClient _makeAPICall end
Jun 21 22:19:16 agentavtone-worker2.fyre.ibm.com hubot[16372]: verbose: BaseAPIClient _callTransport - Retrying [object Object]
Jun 21 22:19:16 agentavtone-worker2.fyre.ibm.com hubot[16372]: debug: BaseAPIClient _callTransport end
Jun 21 22:19:17 agentavtone-worker2.fyre.ibm.com hubot[16372]: info: Rate limited, will retry 60 seconds
Jun 21 22:19:49 agentavtone-worker2.fyre.ibm.com systemd[1]: Stopping StackStorm service st2chatops...
Jun 21 22:19:49 agentavtone-worker2.fyre.ibm.com systemd[1]: Stopped StackStorm service st2chatops.
Hint: Some lines were ellipsized, use -l to show in full.
[root@agentavtone-worker2 ansible-st2]#
dove-young commented 4 years ago

After systemctl daemon-reload , st2chatops can be found in systemctl status st2chatops, but it does not work. and it is not found in systemctl list-units.

[root@ chatops]# systemctl status st2chatops
● st2chatops.service - StackStorm service st2chatops
   Loaded: loaded (/usr/lib/systemd/system/st2chatops.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Tue 2020-06-23 22:42:55 PDT; 4min 25s ago
 Main PID: 558 (code=exited, status=0/SUCCESS)

Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com systemd[1]: Started StackStorm service st2chatops.
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: Wed, 24 Jun 2020 05:42:54 GMT body-parser deprecated undefined extended: provide extended option at node_modules/hubot/src/robot.js:445:21
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: [Tue Jun 23 2020 22:42:54 GMT-0700 (Pacific Daylight Time)] DEBUG Loading adapter shell
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: No history available
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: [137B blob data]
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: [Tue Jun 23 2020 22:42:54 GMT-0700 (Pacific Daylight Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/src/scripts
[root@ chatops]#

A additional systemctl enable st2chatops is required`

[root@agentavtone-worker2 chatops]# systemctl enable st2chatops
[root@agentavtone-worker2 chatops]#
[root@agentavtone-worker2 chatops]# systemctl status st2chatops
● st2chatops.service - StackStorm service st2chatops
   Loaded: loaded (/usr/lib/systemd/system/st2chatops.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Tue 2020-06-23 22:42:55 PDT; 4min 25s ago
 Main PID: 558 (code=exited, status=0/SUCCESS)

Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com systemd[1]: Started StackStorm service st2chatops.
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: Wed, 24 Jun 2020 05:42:54 GMT body-parser deprecated undefined extended: provide extended option at node_modules/hubot/src/robot.js:445:21
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: [Tue Jun 23 2020 22:42:54 GMT-0700 (Pacific Daylight Time)] DEBUG Loading adapter shell
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: No history available
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: [137B blob data]
Jun 23 22:42:54 agentavtone-worker2.fyre.ibm.com hubot[558]: [Tue Jun 23 2020 22:42:54 GMT-0700 (Pacific Daylight Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/src/scripts
[root@ chatops]#
[root@ chatops]# systemctl start st2chatops; systemctl status st2chatops
● st2chatops.service - StackStorm service st2chatops
   Loaded: loaded (/usr/lib/systemd/system/st2chatops.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-06-23 22:47:37 PDT; 11ms ago
 Main PID: 1462 (hubot)
    Tasks: 1
   Memory: 256.0K
   CGroup: /system.slice/st2chatops.service
           └─1462 /bin/sh /opt/stackstorm/chatops/bin/hubot

Jun 23 22:47:37 agentavtone-worker2.fyre.ibm.com systemd[1]: Started StackStorm service st2chatops.
[root@ chatops]# systemctl start st2chatops; systemctl status st2chatops
arm4b commented 4 years ago

Requested more info and waiting for reply in https://github.com/StackStorm/ansible-st2/pull/263#pullrequestreview-436506325

arm4b commented 1 year ago

closing as no more info was provided and the issue is not reproducible