You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
4.8 KiB
139 lines
4.8 KiB
--- |
|
# Copyright 2019 Red Hat, Inc. |
|
# All Rights Reserved. |
|
# |
|
# 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. |
|
|
|
|
|
# "tripleo_bootstrap" will search for and load any operating system variable file |
|
|
|
# found within the "vars/" path. If no OS files are found the task will skip. |
|
- name: Gather variables for each operating system |
|
include_vars: "{{ item }}" |
|
with_first_found: |
|
- skip: true |
|
files: |
|
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml" |
|
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml" |
|
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml" |
|
- "{{ ansible_facts['distribution'] | lower }}.yml" |
|
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml" |
|
- "{{ ansible_facts['os_family'] | lower }}.yml" |
|
tags: |
|
- always |
|
|
|
# Currently only supported on RHEL as tripleo does not have a version package |
|
- name: Deploy release version package |
|
become: true |
|
package: |
|
name: "{{ tripleo_bootstrap_release_version_package }}" |
|
state: present |
|
when: |
|
- (ansible_facts['distribution'] | lower) == 'redhat' |
|
- (tripleo_bootstrap_release_version_package |list | length) > 0 |
|
|
|
- name: Deploy required packages to bootstrap TripleO |
|
become: true |
|
package: |
|
name: "{{ tripleo_bootstrap_packages_bootstrap }}" |
|
state: present |
|
# When a node is deployed with overcloud-minimal, OVS isn't required so let's |
|
# ignore the case where the package can't be found (e.g. missing subscription). |
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1820306 |
|
failed_when: |
|
- (ansible_facts['distribution'] | lower) == 'redhat' |
|
- not ansible_check_mode|bool |
|
- (tripleo_bootstrap_packages_bootstrap_result.rc | int) == 1 |
|
- not ('No package openvswitch available.' in tripleo_bootstrap_packages_bootstrap_result.failures | default([])) |
|
register: tripleo_bootstrap_packages_bootstrap_result |
|
|
|
- name: Create /var/lib/heat-config/tripleo-config-download directory for deployment data |
|
become: true |
|
file: |
|
path: /var/lib/heat-config/tripleo-config-download |
|
state: directory |
|
|
|
- name: Deploy and enable network service |
|
become: true |
|
when: |
|
- (tripleo_bootstrap_legacy_network_packages | length) > 0 |
|
block: |
|
- name: Deploy network-scripts required for deprecated network service |
|
package: |
|
name: "{{ tripleo_bootstrap_legacy_network_packages }}" |
|
state: present |
|
|
|
- name: Ensure network service is enabled |
|
systemd: |
|
name: "{{ tripleo_bootstrap_network_service }}" |
|
enabled: true |
|
|
|
- name: Stop NetworkManager from updating resolv.conf |
|
become: true |
|
when: tripleo_bootstrap_network_service == 'NetworkManager' |
|
block: |
|
- name: Set 'dns=none' in /etc/NetworkManager/NetworkManager.conf |
|
ini_file: |
|
path: /etc/NetworkManager/NetworkManager.conf |
|
state: present |
|
no_extra_spaces: true |
|
section: main |
|
option: dns |
|
value: none |
|
backup: true |
|
|
|
- name: Reload NetworkManager |
|
service: |
|
name: NetworkManager |
|
state: reloaded |
|
|
|
- name: Symlink puppet modules under /etc/puppet/modules |
|
become: true |
|
shell: >- |
|
ln -f -s /usr/share/openstack-puppet/modules/* /etc/puppet/modules/ |
|
args: |
|
warn: false |
|
register: result |
|
failed_when: false |
|
tags: |
|
- skip_ansible_lint |
|
|
|
- name: Create empty ruleset in /etc/sysconfig/iptables and /etc/sysconfig/ip6tables |
|
become: true |
|
ignore_errors: "{{ (((ansible_facts['os_family'] | lower) ~ '-' ~ ansible_facts['distribution_major_version']) == 'redhat-7') | bool }}" |
|
copy: |
|
dest: "{{ item }}" |
|
content: "# empty ruleset created by deployed-server bootstrap" |
|
loop: |
|
- /etc/sysconfig/iptables |
|
- /etc/sysconfig/ip6tables |
|
|
|
- name: Check if /usr/bin/ansible-playbook exists |
|
stat: |
|
path: /usr/bin/ansible-playbook |
|
register: stat_ansible_playbook |
|
|
|
- name: Check if /usr/bin/ansible-playbook-3 exists |
|
stat: |
|
path: /usr/bin/ansible-playbook-3 |
|
register: stat_ansible_playbook_3 |
|
|
|
- name: Symlink /usr/bin/ansible-playbook-3 to /usr/bin/ansible-playbook |
|
become: true |
|
file: |
|
state: link |
|
src: /usr/bin/ansible-playbook |
|
path: /usr/bin/ansible-playbook-3 |
|
when: |
|
- stat_ansible_playbook.stat.exists |
|
- not stat_ansible_playbook_3.stat.exists
|
|
|