Bug 2025523 - Ansible roles are not starting automatically after provisioning
Summary: Ansible roles are not starting automatically after provisioning
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible - Configuration Management
Version: 6.10.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 6.11.0
Assignee: satellite6-bugs
QA Contact: Sam Bible
URL:
Whiteboard:
: 2053451 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-22 12:46 UTC by Stefan Meyer
Modified: 2022-07-05 14:30 UTC (History)
24 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2043701 (view as bug list)
Environment:
Last Closed: 2022-07-05 14:30:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 2029375 1 unspecified CLOSED webhook event "build_exited" never gets triggered 2022-07-05 14:31:02 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:30:39 UTC

Description Stefan Meyer 2021-11-22 12:46:52 UTC
Description of problem:
After provisioning a new host the assigned Ansible roles from hostgroups
are not executed on the new host

Version-Release number of selected component (if applicable):
- Satellite 6.10.1

How reproducible:


Steps to Reproduce:
1. Deploy a new host
2. Check if the default ansible roles have been executed on the new host


Actual results:
- No job is scheduled after the new host finished the build

Expected results:
- A job to run all assigned Ansible roles should be scheduled 

Additional info:
- by default webhooks plugin was not installed after update to 6.10

Comment 16 Mike Murphy 2021-12-14 22:31:34 UTC
Hi, we are requesting a status update. Thanks.

Comment 17 Mike Murphy 2021-12-15 16:59:56 UTC
From customer: Ideally we would like to be able to build servers with no manual intervention beyond pressing a button. This makes it so someone has to manually run a Run All Ansible Roles job on a server after it is built. I'm wondering if it might be possible to put in some sort of workaround, possibly using foreman_webhooks.

Comment 21 Dominic Kohls 2022-01-31 15:05:33 UTC
Hey guys, 

as this bug is not yet fixed in satellite 6.10.1, you can apply the following fix from upstream: https://projects.theforeman.org/issues/34110

Change line 112 in file /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.42/app/models/katello/concerns/host_managed_extensions.rb

https://projects.theforeman.org/projects/katello/repository/revisions/353ebfc0ab489458a9882c759bb3d7ec6b16f85d/diff/app/models/katello/concerns/host_managed_extensions.rb

Best regards!

Comment 22 gstogian 2022-02-14 09:53:21 UTC
Hello team,

We have another Customer that hit the same issue. The workaround has been applied from this Bugzilla but Customer has the following query:

The patch made the hook trigger, but how do we pass the name of the host to the hook? When using an URL like this (which works for "Host updated" event):

https://satellite.example.com/svv/provisioning/webhooks/build-exit/<%= @object.name %>

we get the following error:

Backtrace for 'undefined method '#name' for NilClass::Jail (NilClass)' error (Safemode::NoMethodError): undefined method '#name' for NilClass::Jail (NilClass)

Comment 23 Adam Ruzicka 2022-02-15 09:50:10 UTC
The question (and cause for needinfo) in #22 is not really related to this BZ in any way, sorry for derailing the thread. If you reach out to us we'll always try to help, but raising needinfos on sat6-bugs is not the best way, there are better communication channels for this.

> When using an URL like this (which works for "Host updated" event):

The event triggered when a host is updated carries the whole host as @object so you can use @object.name on it.

> but how do we pass the name of the host to the hook?

If I'm reading things right then build status changes carry only the id and hostname of the host as @id and @hostname respectively, so you should be able to do https://satellite.example.com/svv/provisioning/webhooks/build-exit/<%= @hostname %>

Comment 24 Ondřej Ezr 2022-02-24 13:01:18 UTC
*** Bug 2053451 has been marked as a duplicate of this bug. ***

Comment 25 Sam Bible 2022-05-03 20:12:39 UTC
Version-Release number of selected component (if applicable):
- Satellite 6.11 - 18

Steps to Reproduce:
1. Create a host group with default Ansible roles.
1. Deploy a new host under that host group.

Actual results:
- A job running the hostgroup's ansible roles was scheduled.

Expected results:
- A job to run all assigned Ansible roles should be scheduled

Comment 28 errata-xmlrpc 2022-07-05 14:30:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5498


Note You need to log in before you can comment on or make changes to this bug.