Skip to content

Commit

Permalink
Play ansible roles on host
Browse files Browse the repository at this point in the history
  • Loading branch information
lhellebr committed Jun 15, 2023
1 parent 27932aa commit 3da4458
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4332,6 +4332,25 @@ def bulk_available_incremental_updates(self, synchronous=True, timeout=None, **k
response = client.post(self.path('bulk/available_incremental_updates'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)

def play_roles(self, synchronous=True, timeout=None, **kwargs):
"""Play all assigned ansible roles
:param synchronous: What should happen if the server returns an HTTP
202 (accepted) status code? Wait for the task to complete if
``True``. Immediately return the server's response otherwise.
:param timeout: Maximum number of seconds to wait until timing out.
Defaults to ``nailgun.entity_mixins.TASK_TIMEOUT``.
:param kwargs: Arguments to pass to requests.
:returns: The server's response, with all content decoded.
:raises: ``requests.exceptions.HTTPError`` If the server responds with
an HTTP 4XX or 5XX message.
"""
kwargs = kwargs.copy() # shadow the passed-in kwargs
kwargs.update(self._server_config.get_client_kwargs())
response = client.post(self.path('play_roles'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)['task_id']

def get_facts(self, synchronous=True, timeout=None, **kwargs):
"""List all fact values of a given host
Expand Down Expand Up @@ -4504,6 +4523,7 @@ def path(self, which=None):
'errata/applicability',
'facts',
'packages',
'play_roles',
'power',
'puppetclass_ids',
'smart_class_parameters',
Expand Down

0 comments on commit 3da4458

Please sign in to comment.