From d39d4d9a9eaab39a8c3ae22dc2a877e684f82b0d Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Thu, 10 Dec 2020 14:42:46 -0500 Subject: [PATCH] add job id to iso management playbook output * It's hard/impossible to know what job a check_isolated.yml playbook runs for by just looking at the logs. * Forward the job id for which an iso management playbook is running for and output that job id so it can be found in the logs. --- awx/main/isolated/manager.py | 8 ++++++-- awx/playbooks/check_isolated.yml | 3 +++ awx/playbooks/run_isolated.yml | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/awx/main/isolated/manager.py b/awx/main/isolated/manager.py index 9a45db6f49..4f8f2ce6bb 100644 --- a/awx/main/isolated/manager.py +++ b/awx/main/isolated/manager.py @@ -169,7 +169,8 @@ class IsolatedManager(object): extravars = { 'src': self.private_data_dir, 'dest': settings.AWX_PROOT_BASE_PATH, - 'ident': self.ident + 'ident': self.ident, + 'job_id': self.instance.id, } if playbook: extravars['playbook'] = playbook @@ -205,7 +206,10 @@ class IsolatedManager(object): :param interval: an interval (in seconds) to wait between status polls """ interval = interval if interval is not None else settings.AWX_ISOLATED_CHECK_INTERVAL - extravars = {'src': self.private_data_dir} + extravars = { + 'src': self.private_data_dir, + 'job_id': self.instance.id + } status = 'failed' rc = None last_check = time.time() diff --git a/awx/playbooks/check_isolated.yml b/awx/playbooks/check_isolated.yml index 18b3305846..472b772fbb 100644 --- a/awx/playbooks/check_isolated.yml +++ b/awx/playbooks/check_isolated.yml @@ -9,6 +9,9 @@ - ansible.posix tasks: + - name: "Output job the playbook is running for" + debug: + msg: "Checking on job {{ job_id }}" - name: Determine if daemon process is alive. shell: "ansible-runner is-alive {{src}}" diff --git a/awx/playbooks/run_isolated.yml b/awx/playbooks/run_isolated.yml index 4e3b7b54ee..76ea42d17c 100644 --- a/awx/playbooks/run_isolated.yml +++ b/awx/playbooks/run_isolated.yml @@ -13,6 +13,10 @@ - ansible.posix tasks: + - name: "Output job the playbook is running for" + debug: + msg: "Checking on job {{ job_id }}" + - name: synchronize job environment with isolated host synchronize: copy_links: true