02f011e1fa
Change-Id: I30cbc8d9093110edcb8d653a4ab60d4b85f8a58d
106 lines
3.3 KiB
YAML
106 lines
3.3 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: Gather variables for each operating system
|
|
include_vars: "{{ item }}"
|
|
with_first_found:
|
|
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
|
|
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
|
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
|
- "{{ ansible_distribution | lower }}.yml"
|
|
- "{{ ansible_os_family | lower }}.yml"
|
|
tags:
|
|
- always
|
|
|
|
- name: Allow the usage of local facts
|
|
file:
|
|
path: /etc/ansible/facts.d/
|
|
state: directory
|
|
tags:
|
|
- openstack_hosts-install
|
|
|
|
# Deploy the release file everywhere
|
|
- import_tasks: openstack_release.yml
|
|
tags:
|
|
- openstack_hosts-install
|
|
|
|
# Proxy configuration applies to all nodes
|
|
- name: Add global_environment_variables to environment file
|
|
blockinfile:
|
|
dest: "/etc/environment"
|
|
state: present
|
|
marker: "# {mark} Managed by OpenStack-Ansible"
|
|
insertbefore: EOF
|
|
block: "{{ lookup('template', 'environment.j2') }}"
|
|
tags:
|
|
- openstack_hosts-config
|
|
|
|
# Configure host files should apply to all nodes
|
|
- name: Configure etc hosts files
|
|
import_tasks: openstack_update_hosts_file.yml
|
|
when:
|
|
- openstack_host_manage_hosts_file | bool
|
|
tags:
|
|
- openstack_hosts-config
|
|
|
|
- name: Remove the blacklisted packages
|
|
package:
|
|
name: "{{ openstack_hosts_package_list | selectattr('state','equalto','absent') | map(attribute='name') | list }}"
|
|
state: absent
|
|
|
|
# This allows to include this role to get all the distro
|
|
# specific configuration for all the nodes.
|
|
# It is also used for installing common packages to
|
|
# all nodes
|
|
- name: Apply package management distro specific configuration
|
|
include_tasks: "openstack_hosts_configure_{{ ansible_pkg_mgr | lower }}.yml"
|
|
|
|
# Configure bare metal nodes: Kernel, sysctl, sysstat, hosts files, metal packages
|
|
- import_tasks: configure_metal_hosts.yml
|
|
when:
|
|
- not is_container
|
|
tags:
|
|
- openstack_hosts-install
|
|
|
|
- name: Install distro packages
|
|
package:
|
|
name: "{{ openstack_host_distro_packages }}"
|
|
state: "{{ openstack_hosts_package_state }}"
|
|
when:
|
|
- openstack_host_distro_packages | length > 0
|
|
register: install_packages
|
|
until: install_packages is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Install user defined extra distro packages
|
|
package:
|
|
name: "{{ openstack_host_extra_distro_packages }}"
|
|
state: "{{ openstack_hosts_package_state }}"
|
|
when:
|
|
- openstack_host_extra_distro_packages | length > 0
|
|
register: install_packages
|
|
until: install_packages is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- import_tasks: openstack_authorized_keys.yml
|
|
tags:
|
|
- openstack_hosts-config
|
|
|
|
- import_tasks: openstack_hosts_ca_certificates.yml
|
|
tags:
|
|
- openstack_hosts-config
|