Monit with Ansible - invalid mail format '#015'

om flag

I've been trying to install monit with an ansible playbook. I'm changing the monitrc file and when the playbook restarts monit, I get :

Jun  8 08:00:30 myserver monit[1857462]: Starting daemon monitor: monit
Jun  8 08:00:30 myserver monit[1857465]: /etc/monit/monitrc:10: invalid mail format '#015'
Jun  8 08:00:30 myserver monit[1857465]: /etc/monit/monitrc:11: syntax error 'subject: $HOST -- $EVENT $SERVICE#015'
Jun  8 08:00:30 myserver monit[1857466]:  failed!
Jun  8 08:00:30 myserver systemd[1]: monit.service: Control process exited, code=exited, status=1/FAILURE
Jun  8 08:00:30 myserver systemd[1]: monit.service: Failed with result 'exit-code'.
Jun  8 08:00:30 myserver systemd[1]: Failed to start LSB: service and resource monitoring daemon.

The conflicting lines in monitrc :

set mail-format {
  from: Monit <[email protected]>
  subject: $HOST -- $EVENT $SERVICE
  message: $EVENT Service $SERVICE
                Date: $DATE
                Action: $ACTION
                Host: $HOST

Here are the different tests I did :

  • Installing monit from playbook ( Installing from apt then copy the monitrc file to its location) : Does not work
  • Installing monit manually (installing from apt then copy-pasting the configuration to monitrc) : Works
  • Copy-pasting monitrc after the ansible install : Does not work

Monit version is 5.27.2 in both cases and the machine is Debian 11.

om flag

The problem was that the files I was copying with ansible where in CRLF format. I had to switch them to LF so that monit could read the files.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.