Actually remove the unused RedHat repository

This commit is contained in:
Michael Russell 2019-01-02 10:06:47 +01:00
parent 486717bc6f
commit 5126dbc5e8
No known key found for this signature in database
GPG key ID: A90C1696496085FE
2 changed files with 28 additions and 3 deletions

View file

@ -20,9 +20,9 @@
- name: RedHat - remove unused Elasticsearch repo
become: yes
template:
src: 'elasticsearch.repo'
dest: '/etc/yum.repos.d/elasticsearch-{{ es_other_repo_name }}.repo'
file:
path: '/etc/yum.repos.d/elasticsearch-{{ es_other_repo_name }}.repo'
state: absent
when: es_use_repository
- name: RedHat - include versionlock

View file

@ -167,4 +167,29 @@ shared_examples 'shared::init' do |vars|
its(:content) { should match "path.data: #{vars['data_dirs'].join(',')}" }
its(:content) { should match "path.logs: /var/log/elasticsearch/localhost-#{vars['es_instance_name']}" }
end
if vars['es_use_repository']
if vars['ansible_os_family'] == 'RedHat'
describe file("/etc/yum.repos.d/elasticsearch-#{vars['es_repo_name']}.repo") do
it { should exist }
end
describe yumrepo("elasticsearch-#{vars['es_repo_name']}") do
it { should exist }
it { should be_enabled }
end
describe file("/etc/yum.repos.d/elasticsearch-#{vars['es_other_repo_name']}.repo") do
it { should_not exist }
end
describe yumrepo("elasticsearch-#{vars['es_other_repo_name']}") do
it { should_not exist }
it { should_not be_enabled }
end
end
if vars['ansible_os_family'] == 'Debian'
describe command('apt-cache policy') do
its(:stdout) { should match /elastic.co.*\/#{Regexp.quote(vars['es_repo_name'])}\//}
its(:stdout) { should_not match /elastic.co.*\/#{Regexp.quote(vars['es_other_repo_name'])}\//}
end
end
end
end