diff --git a/roles/yarn/resourcemanager/tasks/capacity_scheduler.yml b/roles/yarn/resourcemanager/tasks/capacity_scheduler.yml index 81679077..bd206282 100644 --- a/roles/yarn/resourcemanager/tasks/capacity_scheduler.yml +++ b/roles/yarn/resourcemanager/tasks/capacity_scheduler.yml @@ -10,10 +10,20 @@ group: root mode: "644" +- name: Check if Hadoop YARN ResourceManager service is running + ansible.builtin.systemd: + name: hadoop-yarn-resourcemanager.service + state: started + register: yarn_service + ignore_errors: true + - name: "Yarn scheduler | take kerberos ticket" ansible.builtin.command: kinit -kt /etc/security/keytabs/rm.service.keytab "rm/{{ ansible_hostname | tosit.tdp.access_fqdn(hostvars) }}@{{ realm }}" become_user: yarn + when: yarn_service is defined and yarn_service.status.ActiveState == 'active' - name: "Yarn scheduler | Refresh Queues" ansible.builtin.command: /usr/bin/yarn rmadmin -refreshQueues become_user: yarn + when: yarn_service is defined and yarn_service.status.ActiveState == 'active' +