From 6c5f72b550df2c20deedfe713df2b8fbd2919b0d Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 23 Apr 2018 15:29:46 +0000 Subject: [PATCH] Yum custom repo creation requires root We can't assume the executing user is root, so use become. Also uses a block to perform the RedHat-only check. Change-Id: Ibf2da6b8086bc8e34b33f113067a213a33213161 Story: 2001898 Task: 14383 --- ansible/roles/yum/tasks/custom_repo.yml | 2 +- ansible/roles/yum/tasks/main.yml | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ansible/roles/yum/tasks/custom_repo.yml b/ansible/roles/yum/tasks/custom_repo.yml index 72034be0c..355b346bc 100644 --- a/ansible/roles/yum/tasks/custom_repo.yml +++ b/ansible/roles/yum/tasks/custom_repo.yml @@ -25,4 +25,4 @@ retries: 3 delay: 10 until: "'failed' not in register_yum_command" - when: ansible_os_family == 'RedHat' + become: true diff --git a/ansible/roles/yum/tasks/main.yml b/ansible/roles/yum/tasks/main.yml index 07f63a3e0..a27a33a72 100644 --- a/ansible/roles/yum/tasks/main.yml +++ b/ansible/roles/yum/tasks/main.yml @@ -1,8 +1,7 @@ --- +- block: + - include: redhat.yml + when: yum_use_local_mirror | bool -- include: redhat.yml - when: - - ansible_os_family == "RedHat" - - yum_use_local_mirror - -- include: custom_repo.yml + - include: custom_repo.yml + when: ansible_os_family == 'RedHat'