f8a150cc76
We currently have spread out package/host management to multiple roles, sometimes repeating ourselves in the process (see pip_install and openstack_hosts overlap) That is against Ansible principles, and we should have one role that configures the minimum (to run openstack), applying it to all the nodes, maybe behaving slightly differently depending on some parameters. Here that parameter is if the host is a container or not. If the host is a container, all the physical host configuration (kernel and sysctl) is be skipped, the rest of the configuration (packages/repos) still applies. This needed a refactor to split the tasks into those two group while remaining efficient and avoid multiple back and forth of package installs/removal. For that last point, new defaults variables were introduced, allowing overrides per host/group. A node now member of a group x can now directly use this role to setup all its necessary repos and keys. Last, but not least, this override mechanism can now easily trigger pip_install role, which can from now on, be removed from every role. On top of that pip_install role can now remove its repo management, and focus on installing pip on hosts that don't have a proper version of pip installed. Change-Id: Ibf145e561c80a12055bd4d5dca3914c4d495a748
43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
---
|
|
# Copyright 2014, Rackspace US, Inc.
|
|
#
|
|
# 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.
|
|
|
|
- name: Enable sysstat config
|
|
template:
|
|
src: "sysstat.default.j2"
|
|
dest: "{{ openstack_host_sysstat_file }}"
|
|
mode: "0644"
|
|
when:
|
|
- ansible_pkg_mgr == 'apt'
|
|
notify: Restart sysstat
|
|
|
|
- name: Enable sysstat cron
|
|
template:
|
|
src: "{{ openstack_host_cron_template }}"
|
|
dest: "/etc/cron.d/sysstat"
|
|
mode: "{{ openstack_host_sysstat_cron_mode }}"
|
|
|
|
- name: Restore SELinux contexts on sysstat cron file
|
|
command: restorecon -v /etc/cron.d/sysstat
|
|
when:
|
|
- ansible_pkg_mgr in ['yum', 'dnf']
|
|
|
|
- name: Start and enable the sysstat service
|
|
service:
|
|
name: sysstat
|
|
state: started
|
|
enabled: yes
|
|
when:
|
|
- ansible_pkg_mgr in ['yum', 'dnf', 'zypper']
|