Files
openstack-ansible-os_neutron/tasks/neutron_pre_install.yml
Dmitriy Rabotyagov 8b2240ccb3 Auto-fix usage of modules via FQCN
Since ansible-core 2.10 it is recommended to use modules via FQCN
In order to align with recommendation, we perform migration
by applying suggestions made by `ansible-lint --fix=fqcn`

Change-Id: I809637f2b012eed4c761d12870190d0a7b786825
2025-04-02 15:11:21 +00:00

109 lines
3.6 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
ansible.builtin.group:
name: "{{ neutron_system_group_name }}"
state: "present"
system: "yes"
- name: Create the neutron system user
ansible.builtin.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
ansible.builtin.stat:
path: "{{ neutron_conf_dir }}"
register: neutron_conf_dir_stat
- name: Remove the config directory
ansible.builtin.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
ansible.builtin.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) }}"
recurse: "{{ item.recurse | 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 }}/ovn-metadata-proxy"
mode: "u=rwX,g=rX,o=rX"
recurse: true
condition: "{{ (neutron_plugin_type == 'ml2.ovn' and neutron_services['neutron-ovn-metadata-agent']['group'] in group_names) }}"
- path: "{{ neutron_system_home_folder }}/ha_confs"
state: "{{ (neutron_plugin_type == 'ml2.ovn') | ternary('absent', 'directory') }}"
- name: Add dependency repos for Neutron
ansible.builtin.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
ansible.builtin.lineinfile:
dest: "/etc/tmpfiles.d/openstack-openvswitch.conf"
line: "D /var/run/openvswitch 2755 root root"
create: true
mode: "0644"
- name: Create ovs tmp directory
ansible.builtin.file:
path: "/var/run/openvswitch"
state: directory
mode: "02755"
when:
- "'ovs' in neutron_plugin_type | lower"