diff --git a/development/roles/foreman_development/tasks/main.yaml b/development/roles/foreman_development/tasks/main.yaml index 692985917..5dd050817 100644 --- a/development/roles/foreman_development/tasks/main.yaml +++ b/development/roles/foreman_development/tasks/main.yaml @@ -238,6 +238,16 @@ oauth1_consumer_key: "{{ foreman_development_oauth_consumer_key }}" oauth1_consumer_secret: "{{ foreman_development_oauth_consumer_secret }}" ca_path: "{{ foreman_development_ca_certificate }}" + register: foreman_development_pulp_proxy_registration + +- name: Warn about unrecognized Pulp Smart Proxy features + ansible.builtin.debug: + msg: >- + Proxy {{ ansible_facts['fqdn'] }}-pulp has features not recognized by Foreman: + {{ foreman_development_pulp_proxy_registration.entity.smart_proxies[0].unrecognized_features | join(', ') }}. + If these features come from a Smart Proxy plugin, make sure Foreman has the plugin installed too. + when: + - foreman_development_pulp_proxy_registration.entity.smart_proxies[0].unrecognized_features | default([]) | length > 0 - name: Configure smart-proxy for development ansible.builtin.include_tasks: smart-proxy/main.yml diff --git a/development/roles/foreman_development/tasks/smart-proxy/main.yml b/development/roles/foreman_development/tasks/smart-proxy/main.yml index 1e935497b..fd93bedb4 100644 --- a/development/roles/foreman_development/tasks/smart-proxy/main.yml +++ b/development/roles/foreman_development/tasks/smart-proxy/main.yml @@ -145,6 +145,16 @@ oauth1_consumer_secret: "{{ foreman_development_oauth_consumer_secret }}" ca_path: "{{ foreman_development_ca_certificate }}" validate_certs: false + register: foreman_development_proxy_registration + +- name: Warn about unrecognized Smart Proxy features + ansible.builtin.debug: + msg: >- + Proxy {{ ansible_facts['fqdn'] }}-dev has features not recognized by Foreman: + {{ foreman_development_proxy_registration.entity.smart_proxies[0].unrecognized_features | join(', ') }}. + If these features come from a Smart Proxy plugin, make sure Foreman has the plugin installed too. + when: + - foreman_development_proxy_registration.entity.smart_proxies[0].unrecognized_features | default([]) | length > 0 - name: Stop smart-proxy-development service ansible.builtin.systemd: diff --git a/src/playbooks/deploy-proxy/deploy-proxy.yaml b/src/playbooks/deploy-proxy/deploy-proxy.yaml index 6ea0967e8..889b321f3 100644 --- a/src/playbooks/deploy-proxy/deploy-proxy.yaml +++ b/src/playbooks/deploy-proxy/deploy-proxy.yaml @@ -31,4 +31,9 @@ - pulp - systemd_target - foreman_proxy - - post_install + - role: post_install + vars: + post_install_foreman_ca_path: "{{ foreman_proxy_foreman_ca_certificate | default(omit) }}" + post_install_foreman_oauth_consumer_key: "{{ foreman_proxy_oauth_consumer_key }}" + post_install_foreman_oauth_consumer_secret: "{{ foreman_proxy_oauth_consumer_secret }}" + post_install_foreman_server_url: "{{ foreman_proxy_foreman_server_url }}" diff --git a/src/playbooks/deploy/deploy.yaml b/src/playbooks/deploy/deploy.yaml index bd3304cb7..e246117ea 100644 --- a/src/playbooks/deploy/deploy.yaml +++ b/src/playbooks/deploy/deploy.yaml @@ -42,4 +42,11 @@ - role: hammer when: - "'hammer' in enabled_features" - - post_install + - role: post_install + vars: + post_install_foreman_ca_path: "{{ foreman_ca_certificate }}" + post_install_foreman_oauth_consumer_key: "{{ foreman_oauth_consumer_key }}" + post_install_foreman_oauth_consumer_secret: "{{ foreman_oauth_consumer_secret }}" + post_install_foreman_server_url: "{{ foreman_url }}" + post_install_foreman_initial_admin_password: "{{ foreman_initial_admin_password }}" + post_install_foreman_initial_admin_username: "{{ foreman_initial_admin_username }}" diff --git a/src/roles/foreman/tasks/main.yaml b/src/roles/foreman/tasks/main.yaml index b74cc3656..00eab74a7 100644 --- a/src/roles/foreman/tasks/main.yaml +++ b/src/roles/foreman/tasks/main.yaml @@ -325,3 +325,12 @@ register: foreman_tasks_status when: - "'katello' in foreman_status.json['results']" + +- name: Warn about unrecognized Pulp Smart Proxy features + ansible.builtin.debug: + msg: >- + Proxy {{ ansible_facts['fqdn'] }}-pulp has features not recognized by Foreman: + {{ _foreman_pulp_proxy_registration.entity.smart_proxies[0].unrecognized_features | join(', ') }}. + If these features come from a Smart Proxy plugin, make sure Foreman has the plugin installed too. + when: + - _foreman_pulp_proxy_registration.entity.smart_proxies[0].unrecognized_features | default([]) | length > 0 diff --git a/src/roles/post_install/tasks/katello.yaml b/src/roles/post_install/tasks/katello.yaml index 6327e77ac..5db3275e7 100644 --- a/src/roles/post_install/tasks/katello.yaml +++ b/src/roles/post_install/tasks/katello.yaml @@ -5,8 +5,8 @@ - "{{ _post_install_url_msg }}" - "{{ _post_install_cred_msg if (post_install_done_flag is not exists) else '' }}" vars: - _post_install_url_msg: "Foreman is running at {{ foreman_url }}" - _post_install_cred_msg: "Admin credentials: {{ foreman_initial_admin_username }}:{{ foreman_initial_admin_password }}" + _post_install_url_msg: "Foreman is running at {{ post_install_foreman_server_url }}" + _post_install_cred_msg: "Admin credentials: {{ post_install_foreman_initial_admin_username }}:{{ post_install_foreman_initial_admin_password }}" - name: Mark installation as complete ansible.builtin.copy: dest: "{{ post_install_done_flag }}" diff --git a/src/roles/post_install/tasks/main.yaml b/src/roles/post_install/tasks/main.yaml index e8b049b5e..e285b7504 100644 --- a/src/roles/post_install/tasks/main.yaml +++ b/src/roles/post_install/tasks/main.yaml @@ -1,3 +1,6 @@ --- - name: Run post install tasks ansible.builtin.include_tasks: "{{ flavor }}.yaml" + +- name: Check for unrecognized Smart Proxy features + ansible.builtin.include_tasks: smart_proxy_features_check.yaml diff --git a/src/roles/post_install/tasks/smart_proxy_features_check.yaml b/src/roles/post_install/tasks/smart_proxy_features_check.yaml new file mode 100644 index 000000000..0d99854cc --- /dev/null +++ b/src/roles/post_install/tasks/smart_proxy_features_check.yaml @@ -0,0 +1,19 @@ +--- +- name: Get all registered Smart Proxies + theforeman.foreman.resource_info: + server_url: "{{ post_install_foreman_server_url }}" + oauth1_consumer_key: "{{ post_install_foreman_oauth_consumer_key }}" + oauth1_consumer_secret: "{{ post_install_foreman_oauth_consumer_secret }}" + ca_path: "{{ post_install_foreman_ca_path | default(omit) }}" + resource: smart_proxies + full_details: true + register: _post_install_smart_proxies + +- name: Warn about unrecognized Smart Proxy features + ansible.builtin.debug: + msg: >- + Proxy {{ item.name }} reports unrecognized features: {{ item.unrecognized_features | join(', ') }}. + Enable matching features in foremanctl or disable them on the proxy. + loop: "{{ _post_install_smart_proxies.resources }}" + when: + - item.unrecognized_features | default([]) | length > 0