如何通过脚本在 ansible tower 中创建库存后立即进行库存同步(以自动方式)

How to do inventory sync as soon as the inventory is created in ansible tower through script (in an automated fashion)

我想了解如何在使用计划(如下所示)创建清单后立即进行清单同步:

tower-cli schedule create --name sync_schedule --inventory-source 182 --rrule "DTSTART:20190507T183000Z RRULE:FREQ=DAILY;INTERVAL=1;COUNT=1"

想弄清楚规则一旦创建就同步一次。

解决方案是在 API 调用中将“update_on_launch”值设置为真:

curl  --silent -lk  -u $user:$password -H 'Content-Type:application/json' -XPOST -d '{"name": '\"$project_name\"',"inventory": '\"$inventory_id\"',"source_script": 4,"credential": null,"overwrite_vars": true,"overwrite": true,"update_on_launch": true,"verbosity": 1,"update_cache_timeout": 0,"source_regions":"","source_vars":"---\nTERRAFORM_ENV: stl/'$project_name'","source":"custom"}' https://awx.com/api/v2/inventory_sources/