Skip to content

Commit

Permalink
Merge pull request #100 from dev-sec/deprec_warn
Browse files Browse the repository at this point in the history
fix deprecation warning for undefined error. #99
  • Loading branch information
chris-rock authored Oct 24, 2016
2 parents ca0bd54 + 11c8197 commit fa59170
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 fa59170

Please sign in to comment.