I can start go-agent service manually by running:
service go-agent start
I want to start go-agent service using ansible and it is not starting.
not starting using:
- name: start go-agent service
systemd:
name: go-agent
enabled: yes
state: started
daemon_reload: yes
masked: no
not starting using:
- name: start go-agent service
service:
name: go-agent
enabled: yes
state: started
inside /etc/systemd/system I have go-agent.service file.
[root@server]# cat go-agent.service
[Unit]
Description=go-agent
After=syslog.target
[Service]
Type=forking
ExecStart=/bin/env /var/go/go-agent.sh
User=go
KillMode=control-group
Environment=SYSTEMD_KILLMODE_WARNING=true
[Install]
WantedBy=multi-user.target
and
[root@server]# cat /var/go/go-agent.sh
#!/bin/bash
source /etc/default/go-agent
cd /var/lib/go-agent
# Get installed java version
VER=$(rpm -q --queryformat "%{VERSION}" java-1.8.0-openjdk.x86_64)
# Find the location of the installed java binary
JAVA=$(find /usr/lib/jvm -mount -name jre-1.8.0-openjdk-$VER*)/bin/java
exec ${JAVA} -Dcruise.console.publish.interval=10 -Xms128m -Xmx256m -Dgocd.agent.log.dir=/var/log/go-agent -Djava.security.egd=file:/dev/./urandom -Dagent.plugins.md5=950122d2619875fe04e845271cdf44dc -Dagent.binary.md5=sd97fys7dfs7dhf7wmwc8n== -Dagent.launcher.md5=bcm94rgnmortnjghgreg== -Dagent.tfs.md5=jfn3ud8fcv5t49if34fr== -jar /var/lib/go-agent/agent.jar -serverUrl https://server:port -sslVerificationMode NONE &
If I start it manually:
[root@server]# service go-agent start
Started Go Agent.
[root@server]# ps aux | grep go-agent
go 28528 14.9 3.9 2546064 81264 ? Sl 00:44 0:03 java -Dgocd.agent.log.dir=/var/log/go-agent -Dgocd.redirect.stdout.to.file=/var/log/go-agent/go-agent-bootstrapper.out.log -jar /usr/share/go-agent/agent-bootstrapper.jar -serverUrl https://server:port/go
go 28792 31.8 7.0 2302236 144372 ? Sl 00:44 0:06 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64/jre/bin/java -Dcruise.console.publish.interval=10 -Xms128m -Xmx256m -Dgocd.agent.log.dir=/var/log/go-agent -Djava.security.egd=file:/dev/./urandom -Dagent.plugins.md5=950122d2619875fe04e845271cdf44dc -Dagent.binary.md5=sd97fys7dfs7dhf7wmwc8n== -Dagent.launcher.md5=bcm94rgnmortnjghgreg== -Dagent.tfs.md5=jfn3ud8fcv5t49if34fr== -jar /var/lib/go-agent/agent.jar -serverUrl https://server:port -sslVerificationMode NONE &
root 29307 0.0 0.0 121272 936 pts/0 S+ 00:44 0:00 grep --color=auto go-agent
[QA3 root@exim0 go-agent]#
Why not just use the shell module if you just want to start and it is working with ' service go-agent start' ?