diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index 74fd7ee35f3..de6e2a8c8cc 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -1306,8 +1306,8 @@ class YumModule(YumDnf): if self.conf_file and os.path.exists(self.conf_file): self.yum_basecmd += ['-c', self.conf_file] - if repoq: - repoq += ['-c', self.conf_file] + if repoq: + repoq += ['-c', self.conf_file] if self.skip_broken: self.yum_basecmd.extend(['--skip-broken']) diff --git a/test/integration/targets/yum/tasks/yum.yml b/test/integration/targets/yum/tasks/yum.yml index 54bad921597..6dc29cc73fa 100644 --- a/test/integration/targets/yum/tasks/yum.yml +++ b/test/integration/targets/yum/tasks/yum.yml @@ -120,6 +120,15 @@ that: - "yum_result is successful" +- name: install sos with state latest in check mode with config file param + yum: name=sos state=latest conf_file=/etc/yum.conf + check_mode: true + register: yum_result +- name: verify install sos with state latest in check mode with config file param + assert: + that: + - "yum_result is changed" + - name: install sos with state latest in check mode yum: name=sos state=latest check_mode: true @@ -145,6 +154,15 @@ that: - "not yum_result is changed" +- name: install sos with state latest idempotence with config file param + yum: name=sos state=latest + register: yum_result +- name: verify install sos with state latest idempotence with config file param + assert: + that: + - "not yum_result is changed" + + # Multiple packages - name: uninstall sos and bc yum: name=sos,bc state=removed