Search code examples
redisgoogle-cloud-platformsalt-project

SaltStack job detection


Intro

Lately we've been noticing some weird behaviour in our production environment, apprently there's a task pulling the data from Prod Redis into Staging Redis, the process itself is managed by Salt.

What I'm trying to achieve

Bottom line: I want to understand the triger for this action (There's no schedule command for this task, the command is being launched from the Salt master in a different manner).

Some code

This is the .sls which is running this task:

redis-server:
  service.dead:
    - enable: True

fetchredis:
  cmd.run:
    - names:
       - /usr/bin/redis-cli -h {{grains['shost']}} --rdb /etc/redis-cluster/dump.rdb
       - gsutil cp /etc/redis-cluster/dump.rdb gs://redis-rtp-bkp/{{salt['cmd.run']('date +"%Y-%m-%d-%H-%M"')}}-{{grains['shost']}}.rdb
    - prereq:
      - service: redis-server

chown:
  cmd.run:
    - name: chown -R redis /etc/redis-cluster/*
    - cwd: /
    - user: root
    - require:
       - cmd: fetchredis

start_redis:
  service.running:
    - name: redis-server
    - require:
       - cmd: chown

What I've tried so far?

I used all sorts of salt-run queries, either on specific jids that showed nothing or some errors.

Any suggestions on finding the trigger?

Thank you.


Solution

  • Found it, next time I'll know where to look, there was an .sls in the Pillars directory, the content is as follows:

    schedule:
     bkp:
        function: state.sls
        seconds: 600
        args:
          - redis.bkp
    

    Thank you all for your kind help.