Skip to content

Commit

Permalink
fix deprecation warning for undefined error. #99
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Gumprich committed Oct 7, 2016
1 parent ca0bd54 commit 11c8197
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tasks/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
stat: path='/etc/yum/pluginconf.d/rhnplugin.conf'
register: rhnplugin_file

# for the "default([])" see here:
# https://github.com/dev-sec/ansible-os-hardening/issues/99 and
# https://stackoverflow.com/questions/37067827/ansible-deprecation-warning-for-undefined-variable-despite-when-clause
- name: activate gpg-check for yum-repos
replace: dest='{{item}}' regexp='^\s*gpgcheck=0' replace='gpgcheck=1'
with_items:
- '{{ yum_repos.stdout_lines }}'
- '/etc/yum.conf'
- '{{ yum_repos.stdout_lines| default([]) }}'

- name: activate gpg-check for yum rhn if it exists
replace: dest='/etc/yum/pluginconf.d/rhnplugin.conf' regexp='^\s*gpgcheck=0' replace='gpgcheck=1'
Expand Down

0 comments on commit 11c8197

Please sign in to comment.