Hi On Tue, Nov 25, 2014 at 01:24:42PM -0800, Adrian Grebin wrote: > Hi guys, i am new to Ansible, and trying to make good use of it on our > environment. > > We're running a tool that is called Opsware (that is some kind of ansible as > well...) that should be running it's agent on each node. > I want to automate the installation of the agent via ansible and trying to > write a role for it, not sure if i am going to need to write a module, i think > it wont be needed, but would appreciate your feedback. > > I wrote a simple task: > > - name: make sure opsware-agent is runnning > service: name=opsware-agent state=running pattern="/opt/opsware/agent/bin/ > python /opt/opsware/agent/pylibs/shadowbot/daemonbot.pyc --conf /etc/opt/ > opsware/agent/agent.args" > > > > This runs so far when the agent is installed, if it is not running it will > restart it.
That sounds wrong. If it is already running, it should be left alone, as you have "state=running". IIRC Ansible relies on the init script being able to return a status - and many 3rd party init scripts fail to do so... The "pattern" part in ansible is an attempt at working around this, but the init script really should be fixed... (Perhaps you can use ansible to installed a fixed version first?) What does "/etc/init.d/optsware-agent status" say? (and more importantly: What exit code does it give?) > I wonder if the 'pattern' parameter is a good idea to check for the process to > be running if the agent is actually not installed, since it is not installed > via any software package system (yum/apt) so my idea to check if it was > installed is to check if the service is running and if it fails to check the > service status, then it is not installed. Well - hopefully nothing will match the pattern if the right daemon is not installed... > > I am unsure from here how to trigger the install if the 'pattern' > fails... Can you check for the presense of one of the files installed by opsware-agent instead? E.g. /usr/sbin/opsware-agent or similar? Hope this helps -- Karl E. Jorgensen -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20141126210855.GA20567%40hawking. For more options, visit https://groups.google.com/d/optout.
