FAQ
I am using salt reactor to update our dnsmasq host list. Here is the flow I
am currently using

* dnsmasq server is running together with salt-master

* reactor is setup for the minion-start events

     ## /etc/salt/master.d/reactor.conf
     reactor:
       - 'salt/minion/*/start':
           - /srv/reactor/onstart.sls

* The start script will take two actions: 1. check the ip address of the
minion and put its record into dnsmasq host list. 2. inform minion to
update its /etc/resolv.conf to use salt-master as its dns server
    These two actions are defined in dnsmasq.server and dnsmasq.client sls
respectively.

     # /srv/reactor/onstart.sls

     config_0_dnsmasq_server:
       cmd.state.sls:
         - tgt: master.example.com # minion id is always set as the FQDN of
the host
         - arg:
            - dnsmasq.server

     config_1_dnsmasq_client:
       cmd.state.sls:
         - tgt: {{ data['id'] }}
         - arg:
           - dnsmasq.client

This reactor runs fine when remote minions connecting to salt master. But
when the local minion in the master host connects, the dnsmasq.client sls
always fails.

# salt-run jobs.list_jobs
'20140828032833079344':
   Arguments:
   - dnsmasq.server
   Function: state.sls
   StartTime: 2014, Aug 28 03:28:33.079344
   Target: master.example.com
   Target-type: glob
   User: root
'20140828032833124181':
   Arguments:
   - dnsmasq.client
   Function: state.sls
   StartTime: 2014, Aug 28 03:28:33.124181
   Target: master.example.com
   Target-type: glob
   User: root

# salt-run jobs.lookup_jid 20140828032833124181
master.example.com:
     Data failed to compile:
----------
     The function "state.sls" is running as PID 12020 and was started at
2014, Aug 28 03:28:33.079344 with jid 20140828032833079344



Obviously, the second state.sls cannot be executed when the previous one is
still running.

So , is there any way to ensure the dnsmasq.client sls will only be
triggered when dnsmasq.server has been completed?

Regards
Oreh

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Seth House at Aug 29, 2014 at 4:37 pm

    On Wed, Aug 27, 2014 at 9:36 PM, Xiaohui Liu wrote:
    So , is there any way to ensure the dnsmasq.client sls will only be
    triggered when dnsmasq.server has been completed?
    Try using the ``queue`` argument to ``state.sls``:

    config_1_dnsmasq_client:
           cmd.state.sls:
             - tgt: {{ data['id'] }}
             - arg:
               - dnsmasq.client
             - kwarg:
                 queue: True

    http://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.state.html#salt.modules.state.sls

    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Seth House at Aug 29, 2014 at 5:02 pm
    Er. Apologies, that isn't exactly documented...

    It originally came from this pull request:

    https://github.com/saltstack/salt/pull/7254

    I've added docs here:

    https://github.com/saltstack/salt/pull/15386
    On Fri, Aug 29, 2014 at 10:37 AM, Seth House wrote:
    On Wed, Aug 27, 2014 at 9:36 PM, Xiaohui Liu wrote:
    So , is there any way to ensure the dnsmasq.client sls will only be
    triggered when dnsmasq.server has been completed?
    Try using the ``queue`` argument to ``state.sls``:

    config_1_dnsmasq_client:
    cmd.state.sls:
    - tgt: {{ data['id'] }}
    - arg:
    - dnsmasq.client
    - kwarg:
    queue: True

    http://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.state.html#salt.modules.state.sls
    --
    You received this message because you are subscribed to the Google Groups "Salt-users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsalt-users @
postedAug 28, '14 at 3:36a
activeAug 29, '14 at 5:02p
posts3
users2

2 users in discussion

Seth House: 2 posts Xiaohui Liu: 1 post

People

Translate

site design / logo © 2022 Grokbase