Forum Discussion

Esa_Kuusisto_27's avatar
Esa_Kuusisto_27
Icon for Nimbostratus rankNimbostratus
Mar 24, 2014

REST Api and Config sync question.

I am trying to use REST api to make config sync. I have active/standby pair. I can make changes to active unit using REST api. Now I want to make sync to standby unit. Using GUI or TMSH "tmsh run cm config-sync to-group pair-group-name" works fine. In manual page 69 is simple example for ping using run command, but that is not very helpful.

I have done testing by curl and all other commands like making virtualserver work fine. I am asking little help with config sync. This is so far best what I have done:

curl -sk -u admin:adminpw https://demo.box/mgmt/tm/util/tmsh -H 'Content-Type: application/json' -X POST -d '{"command":"run","utilCmdArgs":"run cm config-sync to-group pair-group-name"}'

I think that in url /tm/util..etc I need to change that or something else.

7 Replies

  • Try this:

     curl -sk -u admin:admin -H "Content-Type: application/json" -X POST -d '{"command":"run","utilCmdArgs":"config-sync to-group pair-group-name"}' https://x.x.x.x/mgmt/tm/cm
    
  • I think this is your problem: http://localhost:8110/tm/cm Request is not going where it should go.

     

    • Gregory_Mone_15's avatar
      Gregory_Mone_15
      Icon for Nimbostratus rankNimbostratus
      I thought that as well, but I checked where it's going on the way out, and all looks good, that seems to be the address that I get on every failed WebRequest.
    • StephanManthey's avatar
      StephanManthey
      Icon for MVP rankMVP

      If you still experience issues you may want to try this slightly modified approach (i.e. for sync-failover-device-group devicegroup_lab-01; tested in v12.1.2):

      curl -svk -H "X-F5-Auth-Token: ${token}" -H 'Content-Type: application/json' -X POST -d '{"command":"run","options":[{"to-group":"devicegroup_lab-01"}]}' "https://${bigip}/mgmt/tm/cm/config-sync" | json-format

      Alternatively you can add the options as query parameter (use encoding; tested in v12.1.2):

      curl -svk -H "X-F5-Auth-Token: ${token}" -H 'Content-Type: application/json' -X POST -d '{"command":"run"}' "https://${bigip}/mgmt/tm/cm/config-sync?options=to-group%20devicegroup_lab-01" | json-format

  • I got some support from the folks at F5. It looks like my issue was that I was using REST V11.4 to make the above call (which I believe is supported in 11.5) 11.4 wasn't an option for me (in the timeframe I was looking at), so they sent me a command that works even though they advise against deploying a production app against REST in 11.4

     

    Make a POST to '/mgmt/tm/actions/cm/config-sync/run' with the following payload: {"apiOptions": "to-group sync-failover-1"}

     

    where "sync-failover-1" is the name of the device group.

     

    that command allowed me to successfully sync the device to the group, now I just need to learn how to sync the group back to the device (with the overwrite option enabled)

     

    • masterodeat's avatar
      masterodeat
      Icon for Nimbostratus rankNimbostratus
      Did you ever find how to add the option to enable overwrite?
    • StephanManthey's avatar
      StephanManthey
      Icon for MVP rankMVP

      In case the configurations are inconsistent (changes to both devices w/ sync status "red") you may want to try the following, please (tested in TMOS v12.1.2):

      curl -svk -H "X-F5-Auth-Token: ${token}" -H 'Content-Type: application/json' -X POST -d '{"command":"run","options":[{"force-full-load-push to-group":"devicegroup_lab-01"}]}' "https://${bigip}/mgmt/tm/cm/config-sync" | json-format