Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add edpm role to deploy Neutron DHCP agent #375

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions playbooks/neutron_dhcp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Deploy EDPM Neutron DHCP agent
hosts: all
strategy: linear
become: true
tasks:
- name: Neutron DHCP agent
import_role:
name: osp.edpm.edpm_neutron_dhcp
tags:
- edpm_neutron_dhcp
5 changes: 5 additions & 0 deletions roles/edpm_download_cache/tasks/container_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@
tags:
- edpm_neutron_sriov
- download_cache

- name: Download images for edpm_neutron_dhcp role
ansible.builtin.include_role:
name: osp.edpm.edpm_neutron_dhcp
tasks_from: download_cache.yml
8 changes: 8 additions & 0 deletions roles/edpm_neutron_dhcp/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- slawqo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think you could also add yourself to network-approvers list (separate PR). Just saying.

- network-approvers

reviewers:
- slawqo
- network-approvers
83 changes: 83 additions & 0 deletions roles/edpm_neutron_dhcp/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
# Copyright 2023 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.


# All variables intended for modification should be placed in this file.
# All variables within this role should have a prefix of "edpm_neutron_dhcp"

# seconds between retries for download tasks
edpm_neutron_dhcp_images_download_delay: 5

# number of retries for download tasks
edpm_neutron_dhcp_images_download_retries: 5

edpm_neutron_dhcp_agent_config_src: "/var/lib/openstack/configs/neutron-dhcp"
edpm_neutron_dhcp_agent_config_dir: "/var/lib/config-data/ansible-generated/neutron-dhcp-agent"
edpm_neutron_dhcp_image: "quay.io/podified-antelope-centos9/openstack-neutron-dhcp-agent:current-podified"

edpm_neutron_dhcp_common_volumes:
- /run/netns:/run/netns:shared
- "{{ edpm_neutron_dhcp_agent_config_dir }}:/etc/neutron.conf.d:z"
- /var/lib/neutron:/var/lib/neutron:shared,z
- /var/lib/kolla/config_files/neutron_dhcp_agent.json:/var/lib/kolla/config_files/config.json:ro
- /var/log/containers/neutron:/var/log/neutron:z
- /run/openvswitch:/run/openvswitch:shared,z

# neutron.conf
# DEFAULT
edpm_neutron_dhcp_DEFAULT_debug: false
edpm_neutron_dhcp_DEFAULT_rpc_response_timeout: 60
edpm_neutron_dhcp_DEFAULT_transport_url: ''

# oslo_concurrency
edpm_neutron_dhcp_oslo_concurrency_lock_patch: '$state_path/lock'
# oslo_messaging_rabbit
edpm_neutron_dhcp_oslo_messaging_rabbit_heartbeat_timeout_threshold: 60
# oslo_middleware
edpm_neutron_dhcp_oslo_middleware_enable_proxy_headers_parsing: 60

# rootwrap.conf
# DEFAULT
edpm_neutron_dhcp_rootwrap_DEFAULT_filters_path: '/etc/neutron/rootwrap.d,/usr/share/neutron/rootwrap'
edpm_neutron_dhcp_rootwrap_DEFAULT_exec_dirs: '/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin,/etc/neutron/kill_scripts'
edpm_neutron_dhcp_rootwrap_DEFAULT_use_syslog: False
edpm_neutron_dhcp_rootwrap_DEFAULT_syslog_log_facility: 'syslog'
edpm_neutron_dhcp_rootwrap_DEFAULT_syslog_log_level: 'ERROR'
edpm_neutron_dhcp_rootwrap_DEFAULT_daemon_timeout: 600
edpm_neutron_dhcp_rootwrap_DEFAULT_rlimit_nofile: 1024

# neutron-dhcp-agent.conf
# DEFAULT
edpm_neutron_dhcp_agent_DEFAULT_state_path: '/var/lib/neutron'
edpm_neutron_dhcp_agent_DEFAULT_host: '{{ ansible_facts["nodename"] }}'
edpm_neutron_dhcp_agent_DEFAULT_resync_interval: 5
edpm_neutron_dhcp_agent_DEFAULT_resync_throttle: 1
edpm_neutron_dhcp_agent_DEFAULT_dhcp_driver: 'neutron.agent.linux.dhcp.Dnsmasq'
edpm_neutron_dhcp_agent_DEFAULT_enable_isolated_metadata: False
edpm_neutron_dhcp_agent_DEFAULT_force_metadata: False
edpm_neutron_dhcp_agent_DEFAULT_enable_metadata_network: False
edpm_neutron_dhcp_agent_DEFAULT_num_sync_threads: 4
edpm_neutron_dhcp_agent_DEFAULT_bulk_reload_interval: 0
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_dns_servers: ''
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_base_log_dir: ''
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_local_resolv: False
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_lease_max: 16777216
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_enable_addr6_list: False
edpm_neutron_dhcp_agent_DEFAULT_dhcp_broadcast_reply: False
# AGENT
edpm_neutron_dhcp_agent_AGENT_root_helper: 'sudo neutron-rootwrap /etc/neutron.conf.d/01-rootwrap.conf'
edpm_neutron_dhcp_agent_AGENT_report_interval: 30
edpm_neutron_dhcp_agent_AGENT_availability_zone: 'nova'
Empty file.
22 changes: 22 additions & 0 deletions roles/edpm_neutron_dhcp/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# Copyright 2023 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.

- name: restart neutron-dhcp-agent container
become: true
ansible.builtin.systemd:
state: restarted
name: "edpm_neutron_dhcp_agent.service"
listen: "restart neutron-dhcp-agent"
160 changes: 160 additions & 0 deletions roles/edpm_neutron_dhcp/meta/argument_specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
---
argument_specs:
# ./roles/edpm_neutron_dhcp/tasks/main.yml entry point
main:
short_description: The main entry point for the edpm_neutron_dhcp role.
options:
edpm_neutron_dhcp_images_download_delay:
type: int
default: 5
description: The seconds between retries for failed download tasks
edpm_neutron_dhcp_images_download_retries:
type: int
default: 5
description: The number of retries for failed download tasks
edpm_neutron_dhcp_agent_config_src:
default: "/var/lib/openstack/configs/neutron-dhcp"
description: |
The path to the directory containing source of the Neutron DHCP
agent configs.
type: str
edpm_neutron_dhcp_agent_config_dir:
default: "/var/lib/config-data/ansible-generated/neutron-dhcp-agent"
description: |
The path to the directory containing Neutron DHCP agent config
files.
type: str
edpm_neutron_dhcp_image:
default: "quay.io/podified-antelope-centos9/openstack-neutron-dhcp-agent:current-podified"
description: Neutron DHCP agent container image.
type: str
edpm_neutron_dhcp_common_volumes:
default:
- /run/netns:/run/netns:shared
- "{{ edpm_neutron_dhcp_agent_config_dir }}:/etc/neutron.conf.d:z"
- /var/lib/neutron:/var/lib/neutron:shared,z
- /var/lib/kolla/config_files/neutron_dhcp_agent.json:/var/lib/kolla/config_files/config.json:ro
- /var/log/containers/neutron:/var/log/neutron:z
- /run/openvswitch:/run/openvswitch:shared,z
description: List of volumes in a mount point form.
type: list
edpm_neutron_dhcp_DEFAULT_debug:
default: false
description: "Enable or disable DEBUG mode in the Neutron DHCP agent"
type: bool
edpm_neutron_dhcp_DEFAULT_rpc_response_timeout:
default: 60
description: ''
type: int
edpm_neutron_dhcp_DEFAULT_transport_url:
default: ''
description: ''
type: str
edpm_neutron_dhcp_oslo_concurrency_lock_patch:
default: '$state_path/lock'
description: ''
type: str
edpm_neutron_dhcp_oslo_messaging_rabbit_heartbeat_timeout_threshold:
default: 60
description: ''
type: int
edpm_neutron_dhcp_oslo_middleware_enable_proxy_headers_parsing:
default: 60
description: ''
type: int
edpm_neutron_dhcp_rootwrap_DEFAULT_filters_path:
default: '/etc/neutron/rootwrap.d,/usr/share/neutron/rootwrap'
edpm_neutron_dhcp_rootwrap_DEFAULT_exec_dirs:
default: '/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin,/etc/neutron/kill_scripts'
edpm_neutron_dhcp_rootwrap_DEFAULT_use_syslog:
default: false
description: ''
type: bool
edpm_neutron_dhcp_rootwrap_DEFAULT_syslog_log_facility:
default: 'syslog'
description: ''
type: str
edpm_neutron_dhcp_rootwrap_DEFAULT_syslog_log_level:
default: 'ERROR'
description: ''
type: str
edpm_neutron_dhcp_rootwrap_DEFAULT_daemon_timeout:
default: 600
description: ''
type: int
edpm_neutron_dhcp_rootwrap_DEFAULT_rlimit_nofile:
default: 1024
description: ''
type: int
edpm_neutron_dhcp_agent_DEFAULT_state_path:
default: '/var/lib/neutron'
description: ''
type: str
edpm_neutron_dhcp_agent_DEFAULT_host:
default: '{{ ansible_facts["nodename"] }}'
description: ''
type: str
edpm_neutron_dhcp_agent_DEFAULT_resync_interval:
default: 5
description: ''
type: int
edpm_neutron_dhcp_agent_DEFAULT_resync_throttle:
default: 1
description: ''
type: int
edpm_neutron_dhcp_agent_DEFAULT_dhcp_driver:
default: 'neutron.agent.linux.dhcp.Dnsmasq'
description: ''
type: str
edpm_neutron_dhcp_agent_DEFAULT_enable_isolated_metadata:
default: false
description: ''
type: bool
edpm_neutron_dhcp_agent_DEFAULT_force_metadata:
default: '/var/lib/neutron'
description: ''
type: str
edpm_neutron_dhcp_agent_DEFAULT_enable_metadata_network:
default: false
description: ''
type: bool
edpm_neutron_dhcp_agent_DEFAULT_num_sync_threads:
default: 4
description: ''
type: int
edpm_neutron_dhcp_agent_DEFAULT_bulk_reload_interval:
default: 0
description: ''
type: int
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_dns_servers:
default: ''
description: ''
type: str
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_base_log_dir:
default: ''
description: ''
type: str
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_local_resolv:
default: false
description: ''
type: bool
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_lease_max:
default: 16777216
description: ''
type: int
edpm_neutron_dhcp_agent_DEFAULT_dnsmasq_enable_addr6_list:
default: false
description: ''
type: bool
edpm_neutron_dhcp_agent_DEFAULT_dhcp_broadcast_reply:
default: false
description: ''
type: bool
edpm_neutron_dhcp_agent_AGENT_root_helper:
default: 'sudo neutron-rootwrap /etc/neutron.conf.d/01-rootwrap.conf'
description: ''
type: str
edpm_neutron_dhcp_agent_AGENT_report_interval:
default: 300
description: ''
type: int
43 changes: 43 additions & 0 deletions roles/edpm_neutron_dhcp/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
# Copyright 2023 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.


galaxy_info:
author: OpenStack
description: EDPM OpenStack Role -- edpm_neutron_dhcp
company: Red Hat
license: Apache-2.0
min_ansible_version: '2.14'
namespace: openstack
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
platforms:
- name: 'EL'
versions:
- '8'
- '9'

galaxy_tags:
- edpm


# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
dependencies: []
3 changes: 3 additions & 0 deletions roles/edpm_neutron_dhcp/molecule/default/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
collections:
- name: community.general
22 changes: 22 additions & 0 deletions roles/edpm_neutron_dhcp/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# Copyright 2023 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.

- name: Converge
hosts: all
roles:
- role: "edpm_neutron_dhcp"
vars:
edpm_neutron_dhcp_agent_config_src: "{{lookup('env', 'MOLECULE_SCENARIO_DIRECTORY')}}/test-data"
Loading