redhat-openstack / infrared

Plugin based framework that aims to provide an easy-to-use CLI for Ansible based projects
https://infrared.readthedocs.io/en/latest/index.html
Apache License 2.0
99 stars 97 forks source link

undercloud CDN registry issue #356

Closed mrVectorz closed 5 years ago

mrVectorz commented 5 years ago

Description

Using the "tripleo-undercloud" plugin with "--cdn" it forces to use a server_hostname.

Command used:

infrared tripleo-undercloud --version 13   --registry-namespace rhosp13   --images-task=rpm   --cdn ~/Work/randoms/ir_templates/rh-subscription.yaml --build ga --ssl no

The "rh-subscription.yaml" file:

state: present
autosubscribe: true
activationkey: YOUR_ACTIVATION_KEY
org_id: 0123456

Which does not require a "server_hostname" when using org+activation_key.

Solution

Need to change the conditionals on "Check if Satellite server" and the block right after it. What I did to fix it (just changed the two "when"):

- name: Check if Satellite server
  uri:
    url: "https://{{ cdn_creds.server_hostname }}/katello/api/ping"
    validate_certs: no
    status_code: 200, 404
  register: _sat6_check
  when: cdn_creds.server_hostname is defined

- block:
    - name: Download katello-ca-consumer-latest.noarch.rpm
      get_url:
          url: "https://{{ cdn_creds.server_hostname }}/pub/katello-ca-consumer-latest.noarch.rpm"
          dest: "/tmp/katello-ca-consumer-latest.noarch.rpm"
          force: yes
          validate_certs: no

    - name: Install katello-ca-consumer-latest.noarch.rpm
      package:
          name: /tmp/katello-ca-consumer-latest.noarch.rpm
          state: present
  when: cdn_creds.server_hostname is defined and _sat6_check['status'] == 200

ERROR:

NO MORE HOSTS LEFT **** to retry, use: --limit @/home/mmethot/.infrared/plugins/tripleo-undercloud/main.retry

PLAY RECAP **** hypervisor : ok=6 changed=3 unreachable=0 failed=0
localhost : ok=3 changed=2 unreachable=0 failed=0
undercloud-0 : ok=19 changed=10 unreachable=0 failed=1

ERROR Playbook "/home/mmethot/.infrared/plugins/tripleo-undercloud/main.yml" failed!

mrVectorz commented 5 years ago

Fix is in this review: https://review.gerrithub.io/c/redhat-openstack/infrared/+/448592

avishaymahluf commented 5 years ago

@mrVectorz I merged your patch. Thank you for your contribution.