Do you think there's a background process spawned by sysstat that is
modifying it's own cron job?




On Tue, Mar 4, 2014 at 1:54 PM, Adam Morris <[email protected]> wrote:

> I have come across an unusual timing issue...  I'm not sure what is
> causing it but it is repeatable...
>
> Here is a single task file from part of my initial set up... (I've removed
> the AIX and 32 bit variants but they are interspersed with the 64 bit
> RedHat version.
>
> ---
> # file: roles/common/tasks/sar.yml
>
> # Ensure that the necessary package is installed on RedHat
> - name: ensure that the sysstat package is installed for RedHat based
> systems
>   yum: name="sysstat" state=present
>   when: ansible_os_family == "RedHat"
>
> # Add an entry to the cron file to make sure that the line only occurs once
> - name: Verify the crontab file is managed by Ansible
>   lineinfile: 'backup=no dest=/etc/cron.d/sysstat state=present
>               line="#Ansible: sar" insertbefore="/usr/lib64/sa/sa1"'
>   when: ansible_os_family == "RedHat" and ansible_userspace_bits == "64"
>
> # Now modify the cron.d file to check output every ten minutes.
> #  cron either has inotify support, or checks certain locations for changes
> #  every minute.  Either way, no notification is needed.
> - name: modify the cron.d file to run sar every ten minutes for RedHat
>   cron: name="sar" backup=no cron_file=sysstat state=present
> user={{root_user}}
>                 job="/usr/lib64/sa/sa1 600 1" minute="*/10"
>   when: ansible_os_family == "RedHat" and ansible_userspace_bits == "64"
>
>
> So, when I run this as part of a larger playbook I get the following
> behaviour (and no errors)
>
> If sysstat is already installed the /etc/cron.d/sysstat file is modified
> to add the Ansible tag before the existing (default) line and then the cron
> job is modified to look the way that I want it.  This is what I would
> expect.
> If I run the play again nothing changes.  Again this is what I expect.
>
> If sysstat is not installed then it is installed (as expected) and the
> sysstat file is modified to add the new cron job.  But the old one is not
> tagged so I end up with two similar entries in the file.
>
> I could add a deliberate delay in here between installing sysstat and
> modifying the cron job, but I haven't yet.  I'm wondering why I am seeing
> the behaviour that I see.
>
> Any thoughts?
>
> Adam
>
>  --
> 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/0e705fd4-9cdc-4c1e-a90e-8f7607865295%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/0e705fd4-9cdc-4c1e-a90e-8f7607865295%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAEVJ8QN7pgO%2BepuYi%2B3L2q6y7w%3DTzxOVbPuBkXM0QyP_DP-tAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to