2012-11-07 20:52:47 -05:00
|
|
|
#
|
2020-01-07 16:33:05 -08:00
|
|
|
# Cookbook:: openstack-common
|
2012-11-07 20:52:47 -05:00
|
|
|
# library:: default
|
|
|
|
#
|
2021-10-13 23:28:32 -07:00
|
|
|
# Copyright:: 2012-2021, AT&T Services, Inc.
|
2012-11-07 20:52:47 -05:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
2012-11-28 13:12:33 -05:00
|
|
|
|
2014-05-01 16:56:02 -05:00
|
|
|
platform_options = node['openstack']['common']['platform']
|
2014-01-10 17:38:17 -06:00
|
|
|
case node['platform_family']
|
|
|
|
when 'debian'
|
2014-09-29 15:49:37 -04:00
|
|
|
if node['openstack']['apt']['update_apt_cache']
|
2017-11-26 22:40:50 -08:00
|
|
|
# update the apt cache before installing anything
|
|
|
|
apt_update 'default' do
|
|
|
|
action :update
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# populate the necessary apt options
|
|
|
|
# by default, do not overwrite existing configuration files
|
|
|
|
# this alleviates the need to populate package_overrides in every cookbook
|
|
|
|
file '/etc/apt/apt.conf.d/confdef' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
2020-01-07 16:33:05 -08:00
|
|
|
mode '644'
|
2017-11-26 22:40:50 -08:00
|
|
|
content 'Dpkg::Options {
|
|
|
|
"--force-confdef";
|
|
|
|
"--force-confold";
|
|
|
|
}'
|
|
|
|
action :create
|
2014-09-29 15:49:37 -04:00
|
|
|
end
|
2017-11-26 22:40:50 -08:00
|
|
|
|
2014-01-10 17:38:17 -06:00
|
|
|
package 'ubuntu-cloud-keyring' do
|
2014-05-01 16:56:02 -05:00
|
|
|
options platform_options['package_overrides']
|
|
|
|
action :upgrade
|
2012-11-28 13:12:33 -05:00
|
|
|
end
|
|
|
|
|
2014-03-06 10:08:29 -05:00
|
|
|
if node['openstack']['apt']['live_updates_enabled']
|
|
|
|
apt_components = node['openstack']['apt']['components']
|
|
|
|
apt_repository 'openstack-ppa' do
|
|
|
|
uri node['openstack']['apt']['uri']
|
2016-04-18 08:31:50 -07:00
|
|
|
distribution "#{node['lsb']['codename']}-updates/#{node['openstack']['release']}"
|
2014-03-06 10:08:29 -05:00
|
|
|
components apt_components
|
2017-11-26 22:40:50 -08:00
|
|
|
cache_rebuild true # update the cache after a new repo is added
|
2014-03-06 10:08:29 -05:00
|
|
|
end
|
2017-08-20 11:16:38 -04:00
|
|
|
|
|
|
|
# add in the proposed repo, but only if we're in development
|
|
|
|
proposed_action = if node['openstack']['is_release']
|
|
|
|
:remove
|
|
|
|
else
|
|
|
|
:add
|
|
|
|
end
|
|
|
|
|
|
|
|
apt_repository 'openstack-ppa-proposed' do
|
|
|
|
uri node['openstack']['apt']['uri']
|
|
|
|
distribution "#{node['lsb']['codename']}-proposed/#{node['openstack']['release']}"
|
|
|
|
components apt_components
|
|
|
|
action proposed_action
|
2017-11-26 22:40:50 -08:00
|
|
|
cache_rebuild true # update the cache after a new repo is added
|
2017-08-20 11:16:38 -04:00
|
|
|
end
|
2012-11-28 13:12:33 -05:00
|
|
|
end
|
2014-01-10 15:59:08 +00:00
|
|
|
|
2017-11-26 22:40:50 -08:00
|
|
|
when 'rhel'
|
2021-10-15 15:08:36 -07:00
|
|
|
case node['platform_version'].to_i
|
|
|
|
when 7
|
|
|
|
# TODO(ramereth): These packages conflict with the RDO repo for Train
|
|
|
|
node.default['yum']['epel']['exclude'] = 'python2-qpid-proton python2-pyngus qpid-proton-c'
|
|
|
|
when 8
|
|
|
|
# Need PowerTools repo for some of the python deps
|
|
|
|
node.default['yum']['powertools']['enabled'] = true
|
|
|
|
node.default['yum']['powertools']['managed'] = true
|
|
|
|
# Need to use RabbitMQ repo on EL8
|
|
|
|
node.default['yum']['centos-rabbitmq']['enabled'] = true
|
|
|
|
node.default['yum']['centos-rabbitmq']['managed'] = true
|
|
|
|
|
|
|
|
include_recipe 'yum-centos'
|
|
|
|
end
|
2021-10-12 18:08:08 -07:00
|
|
|
|
2019-06-14 15:32:05 -07:00
|
|
|
include_recipe 'yum-epel'
|
|
|
|
|
2017-11-26 22:40:50 -08:00
|
|
|
repo_action = if node['openstack']['yum']['rdo_enabled']
|
|
|
|
:add
|
|
|
|
elsif FileTest.exist? "/etc/yum.repos.d/RDO-#{node['openstack']['release']}.repo"
|
|
|
|
:remove
|
|
|
|
else
|
|
|
|
:nothing
|
|
|
|
end
|
2014-01-15 19:14:37 +08:00
|
|
|
|
2014-01-10 17:38:17 -06:00
|
|
|
yum_repository "RDO-#{node['openstack']['release']}" do
|
|
|
|
description "OpenStack RDO repo for #{node['openstack']['release']}"
|
2014-02-03 15:29:56 +00:00
|
|
|
gpgkey node['openstack']['yum']['repo-key']
|
|
|
|
baseurl node['openstack']['yum']['uri']
|
2015-01-25 09:54:14 -08:00
|
|
|
gpgcheck node['openstack']['yum']['gpgcheck']
|
2014-02-03 15:29:56 +00:00
|
|
|
enabled true
|
2014-01-15 19:14:37 +08:00
|
|
|
action repo_action
|
2014-01-10 15:59:08 +00:00
|
|
|
end
|
2017-08-20 11:16:38 -04:00
|
|
|
|
|
|
|
# add in the RDO deps, but only if we're in development
|
|
|
|
deps_action = if node['openstack']['is_release']
|
|
|
|
:remove
|
|
|
|
else
|
|
|
|
:add
|
|
|
|
end
|
|
|
|
|
|
|
|
yum_repository "RDO-#{node['openstack']['release']}-deps" do
|
|
|
|
description "OpenStack RDO deps repo for #{node['openstack']['release']}"
|
|
|
|
baseurl "https://buildlogs.centos.org/centos/7/cloud/x86_64/openstack-#{node['openstack']['release']}"
|
|
|
|
gpgcheck false
|
|
|
|
enabled true
|
|
|
|
action deps_action
|
|
|
|
end
|
|
|
|
|
|
|
|
package 'centos-release-qemu-ev' do
|
|
|
|
action :upgrade
|
2021-10-15 15:08:36 -07:00
|
|
|
end if node['platform_version'].to_i < 8
|
2012-11-28 13:12:33 -05:00
|
|
|
end
|
2014-09-19 17:08:14 +02:00
|
|
|
|
2018-12-10 08:11:08 -08:00
|
|
|
# install a python
|
2019-09-18 11:07:21 +00:00
|
|
|
package node['openstack']['common']['platform']['python_packages'] do
|
2019-06-14 15:32:05 -07:00
|
|
|
options platform_options['package_overrides']
|
|
|
|
action :upgrade
|
2018-12-10 08:11:08 -08:00
|
|
|
end
|
|
|
|
|
2014-09-19 17:08:14 +02:00
|
|
|
if node['openstack']['databag_type'] == 'vault'
|
|
|
|
chef_gem 'chef-vault' do
|
|
|
|
version node['openstack']['vault_gem_version']
|
|
|
|
end
|
|
|
|
end
|