I have 2 Ansible jobs. Both of them compare files to find their differences. One of them is for crontab and the other one is for users. They are run first of each month and send their report via Email. Email step in both playbooks are the same and only attach part is different. The problem is one of them sends Email and the other one no. This is the Email Step:

- hosts: localhost
  remote_user: root
  - name: Send e-mail attaching files
      host: <host IP>
      port: <port>
      username: <username>
      password: <password>
      subject: Ansible-Crontab
      body: "hi! here is the report of crontab diffrences on every HA machine."
      from: <Email address>
      - <first person Email address>
      - <second person Email address>
      - <third person Email address>
      - "/data1/AnsibleDir/crontab_report/crontab_div.txt"
      charset: us-ascii
      run_once: true

This step is in both scripts. It works on users but it does not work on crontab which means I receive only one Email first of each month. I checked access to each directory and it was the same. Why this happen and how to solve it?

  • 1
    Can you not manually introduce a difference so it would trigger and then manually run the Ansible job in verbose mode to find out exactly what's going on? – wowbagger Apr 24 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.