cancel
Showing results for 
Search instead for 
Did you mean: 
JohnAdams
Flight Engineer
Flight Engineer
  • 5,076 Views

Satellite - A better way to publish and promote?

Hi, folks,

     My approach to publish and promote has been very simple:

hammer content-view publish --id 6 --major 1 --minor `date "+%j"` --description "The `date "+%d-%b-%Y"` (`date "+Day %j"`) version"

hammer content-view version promote --content-view-id 6 --version 1.`date --date="2 weeks ago" "+%j"` --to-lifecycle-environment-id 4 --organization-id 1

hammer content-view version promote etc.

     But the the hammer content-view publish always times out, whereupon the hammer content-view promotes all fail.

     Clearly, I'm going about this wrong. What is the better way?

Thanks,

     John A

Labels (1)
6 Replies
PeterTselios
Starfighter Starfighter
Starfighter
  • 4,949 Views

OK, first things first.
Which Satellite version?

JohnAdams
Flight Engineer
Flight Engineer
  • 4,946 Views

A valid question! I'm on Satellite 6.8.6, I think point 2.

I've gotten a fix for the time-out issue from Red Hat support. It's working so far and I'm happy.

PeterTselios
Starfighter Starfighter
Starfighter
  • 4,931 Views

It would be nice to post the solution here so as other members can benefit too!

Regarding your initial question, I had a similar solution for a client a few years back but on a much older Satellite. I was experiencing the same issues as you. In my case, the solution was to use variables and quotes in the script.

In the last year though, I moved away from scripts. The foreman-ansible modules are supported and they are much better on handling those cases.

More information about them, you can find in the https://access.redhat.com/documentation/en-us/red_hat_ansible_automation_platform/1.2/html/getting_s...

and of course the https://cloud.redhat.com/

JohnAdams
Flight Engineer
Flight Engineer
  • 4,887 Views

Hi, PeterTselios,

     Good point!

     The solution the Red Hat engineer pointed me toward is How to setup hammer API request timeout on Satellite 6.

I hope that's useful,

     John A

Khamid
Flight Engineer Flight Engineer
Flight Engineer
  • 4,920 Views

Mighnot be fully answer to your question, but I'd share my experience. We have been using ansible to automate content promotion using satellite ansible modules.  I have been using this method suuccessfully over a year. 
Here's example code for ansible:
1. Get list of content-views you want to publish:

- name: Pre-tasks | Find all CVs
  redhat.satellite.resource_info:
    username: "{{ sat_user }}"
    password: "{{ sat_password }}"
    server_url: "https://{{ sat_hostname }}"
    organization: "{{ sat_org }}"
    resource: content_views
    validate_certs: no
  register: raw_list_cvs

- name: Pre-tasks | Get resource information
  set_fact:
    list_all_cvs: "{{ raw_list_cvs['resources'] | json_query(jmesquery) | list }}"
  vars: 
    jmesquery: "[*].{name: name, composite: composite, id: id}"
  
- name: Pre-tasks | Extract list of content views
  set_fact:
    sat6_content_views_list: "{{ sat6_content_views_list }} + ['{{ item.name }}' ]"
  loop: "{{ list_all_cvs | reject('search', 'Default_Organization_View') | list }}"
  when: item.composite == false 

2. Publish content to desired Lifecycle environment

- name: Publish content
  redhat.satellite.content_view_version:
    username: "{{ sat_user }}"
    password: "{{ sat_password }}"
    server_url: "https://{{ sat_hostname }}"
    content_view: "{{ item }}"
    organization: "{{ sat_org }}"
    validate_certs: no
    description: "{{ sat_publish_description }}"
    lifecycle_environments:
      - Library
      - "{{ sat_env_name }}"
  loop: "{{ sat6_content_views_list | list }}"
  loop_control:
    loop_var: "item"
  register: cv_publish_sleeper

Screenshot-20210812090231-440x323.png 

JohnAdams
Flight Engineer
Flight Engineer
  • 4,672 Views

Hi, Khamid,

     That's very nice! Where would I look for further documentation for this?

Thanks,

     John A

 

0 Kudos
Join the discussion
You must log in to join this conversation.