Automate content-view publish/promote on Satellite 6

Latest response

Is Satellite server going to have an option to turn on the auto publish and promote to life-cycle environments? Also, is there anyone who has tested this via a script?


Yes, I have created a simple script and run it via crontab. You can do all of with hammer e.g

/usr/bin/hammer content-view publish --organization "**" --name RHEL7-ContentView --description $(/usr/bin/date "+%d-%B-%Y") --async

I use this to publish a new version of the my content views every first day of the month. I think you can use this for the promoting.

hammer content-view version \
promote --content-view cv_n \
--to-lifecycle-environment \

Thank you Gabriel, I will give it a try.

FYI, by default "hammer publish" is in sync mode (wait for the task to finish), you can force an async mode with "--async"

Thanks Pascal.

you can automate this via or

Thank you Klaas.

I have done with hammer script even composite content view and cron it ### publish the content view ## id 19 is composite view we need to publist separate cv=( 6 7 18 ) for i in "${cv[@]}" do printf "Publishing ID : $i \n\n" hammer content-view publish --id done than find the ids of view which are consist of composite , than hammer content-view update --id 19 --component-ids ".. than hammer content-view publish --id

Thanks, What version of Satellite server are you using? 6.3?

Here is what I came up with to publish a CV (in this case for production) with errata limited to the 1st day of last month using a filter. If there is an error the script will email my team. The script will then delete the oldest CV version. I like to keep two in case I have to fall back to the last one. In this case I am deleting the 3rd one, which would be the oldest.

lastmonth=$(date '+%Y-%m-%d' -d "-1 month -$(($(date +%d)-1)) days")

hammer content-view filter rule update --content-view-filter-id 3 --id 1 --start-date "$lastmonth" --organization-id 1
hammer content-view publish --name Prd --organization-id 1
if [ $retval -ne 0 ]
  echo "Please correct any issues" | mail -s "Production Content View Promotion Failed" $to
  hammer --output csv content-view version list --content-view Prd --organization-id 1 > $vlist
  for x in $(cat $vlist| cut -d ',' -f1 | sed -n '4p')
    hammer content-view remove --name Prd --content-view-version-ids "$x" --organization-id 1