shco
shco

Reputation: 19

Service can't start from playbook or as ad-hoc command

I have an issue to start service from Ansible playbook, here is the task

- name: Start Jira Service 
  shell: /etc/init.d/jira start
  become_user: jira

or

- name: Start Jira Service 
  systemd:
   name: jira
   state: started

for troubleshooting the issue:

  1. I tried to run ad-hoc command as bellow ansible -i hosts mig3 -m shell -a "systemctl start jira" --become-user=jira
  2. Run Jira service as /etc/init.d/jira start command on server using same user - it works without any issue
  3. The service successfully stop using ansible -i hosts mig3 -m shell -a "/etc/init.d/jira stop" --become-user=jira
  4. I noticed file catalina.pid on {{ jira_app_folder }}/work/ was created successfully on server but Jira service not available
  5. No logs were written to {{ jira_app_folder }}/logs/catalina.out
  6. I add Jira user as sudoer user and run ansible -i hosts mig3 -m shell -a "/etc/init.d/jira start" --become-user=jira -K
  7. Same issue on other Jira node in the cluster

Jira start -VVV output

We manage Jira service via /etc/init.d.

Any ideas what the root cause?

Upvotes: 0

Views: 582

Answers (1)

dan_linder
dan_linder

Reputation: 1026

(Note, NOT an answer.)

Let's take a step back and re-address some things that would help you (and the StackOverflow community) better help you with the problem.

You start off with two Ansible tasks listed (the "shell:" and the "systemd:" call), but you don't mention the OS type or version for either the machine running Ansible nor the target system you are trying to configure Jira on nor the version and package name (rpm/deb/etc) for the "Jira" executable. The screenshot shows Ansible 2.10.9, which would help in the text of the question. I suggest you add those details, also including the version of Ansible and other information from your environment.

You mention that you can run it "as /etc/init.d/jira start command on server using same user - it works" so that should give a clue that maybe that is the better way to start your playbook given nothing else.

The screenshot provided shows that the playbook executed the command successfully - I would assume that output was from the "shell:" command. But the fact that the Ansible execution shows "CHANGED" in yellow means that Ansible thinks the command ran successfully (it exited with a non-error code), but if you run that with "shell:" that is the same result anytime.

I don't think this is an Ansible question at this point - it looks like the output of the "shell:" command was showing successful output from the /etc/init.d/jira start execution so the lack of Jira logs showing up where you expect them points more toward a Jira configuration issue rather than an Ansible issue.

Not trying to be negative, just trying to give you some hints on how to troubleshoot and give the rest of the community actionable details to work from.

Upvotes: 0

Related Questions