openstack-ansible-os_neutron/tasks/neutron_pre_install.yml
Marc Gariepy e74d486424 Do not install neutron venv if not needed.
Change-Id: I3675cbb5e7e9b37fce47d995e69edde945c1b581
2022-12-03 19:14:24 +00:00

103 lines
3.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: Create the system group
group:
name: "{{ neutron_system_group_name }}"
state: "present"
system: "yes"
- name: Create the neutron system user
user:
name: "{{ neutron_system_user_name }}"
group: "{{ neutron_system_group_name }}"
comment: "{{ neutron_system_comment }}"
shell: "{{ neutron_system_shell }}"
system: "yes"
createhome: "yes"
home: "/var/lib/{{ neutron_system_user_name }}"
# NOTE(cloudnull): During an upgrade the local directory may exist on a source
# install. If the directory does exist it will need to be
# removed. This is required on source installs because the
# config directory is a link.
- name: Source config block
block:
- name: Stat config directory
stat:
path: "{{ neutron_conf_dir }}"
register: neutron_conf_dir_stat
- name: Remove the config directory
file:
path: "{{ neutron_conf_dir }}"
state: absent
when:
- neutron_conf_dir_stat.stat.isdir is defined and
neutron_conf_dir_stat.stat.isdir
when:
- neutron_install_method == 'source'
- ((filtered_neutron_services|length) + (uwsgi_neutron_services|length)) > 0
- name: Create neutron dir
file:
path: "{{ item.path | default(omit) }}"
state: "{{ item.state | default('directory') }}"
owner: "{{ item.owner | default(neutron_system_user_name) }}"
group: "{{ item.group | default(neutron_system_group_name) }}"
mode: "{{ item.mode | default(omit) }}"
when:
- (item.condition | default(true)) | bool
with_items:
- path: "/openstack"
owner: "root"
group: "root"
- path: "{{ neutron_conf_version_dir }}"
mode: "0755"
- path: "/etc/sudoers.d"
mode: "0750"
owner: "root"
group: "root"
- path: "{{ neutron_system_home_folder }}"
mode: "0755"
- path: "{{ neutron_system_home_folder }}/ha_confs"
state: "{{ (neutron_plugin_type == 'ml2.ovn') | ternary('absent','directory') }}"
- name: Add dependency repos for Neutron
package:
name: "{{ neutron_repos }}"
state: "{{ neutron_package_state }}"
retries: 5
delay: 2
when:
- ansible_facts['pkg_mgr'] == 'dnf'
- neutron_needs_openvswitch | bool
- name: Create ovs tempfiles directory
block:
- name: Create ovs tmpfiles file
lineinfile:
dest: "/etc/tmpfiles.d/openstack-openvswitch.conf"
line: "D /var/run/openvswitch 2755 root root"
create: true
- name: Create ovs tmp directory
file:
path: "/var/run/openvswitch"
state: directory
mode: "02755"
when:
- "'ovs' in neutron_plugin_type | lower"