yatinkarel
0b7b2ff40a
ansible-playbook-3 binary is no longer shipped with
ansible 2.9 package[1], so let's create it if it doesn't
exist. Once all usages of ansible-playbook-3 are removed
these all compatibility tasks can be cleaned up.
Also remove symlink creation of /usr/local/bin/ansible-playbook*,
as those were created temporary for fedora support[2].
[1] https://src.fedoraproject.org/rpms/ansible/blob/master/f/ansible.spec
[2] https://review.opendev.org/#/c/632768/
Partial-Bug: #1873443
Change-Id: I40c860f22993efbe375c741c63513d764ba4eebc
(cherry picked from commit 780b5fc46d
)
110 lines
3.9 KiB
YAML
110 lines
3.9 KiB
YAML
---
|
|
# 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_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 }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
|
|
- "{{ ansible_os_family | lower }}.yml"
|
|
tags:
|
|
- always
|
|
|
|
- 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_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: Symlink puppet modules under /etc/puppet/modules
|
|
shell: >-
|
|
ln -f -s /usr/share/openstack-puppet/modules/* /etc/puppet/modules/
|
|
register: result
|
|
failed_when:
|
|
- result.rc != 0
|
|
- "'cannot overwrite directory' not in result.stderr"
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Create empty ruleset in /etc/sysconfig/iptables and /etc/sysconfig/ip6tables
|
|
become: true
|
|
ignore_errors: "{{ (((ansible_os_family | lower) ~ '-' ~ ansible_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
|