Execution
Date 14 Dec 2025 10:21:40 +0000
Duration 00:43:55.98
Controller aio1.openstack.local
User root
Versions
Ansible 2.18.6
ara 1.7.4 / 1.7.4
Python 3.13.5
Summary
13 Hosts
2438 Tasks
2413 Results
107 Plays
511 Files
0 Records

File: /home/zuul/src/opendev.org/openstack/openstack-ansible-os_neutron/tasks/neutron_pre_install.yml

---
# 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"