Skip to content

Commit

Permalink
Merge pull request #344 from booxter/sriov-conf-d-loading
Browse files Browse the repository at this point in the history
neutron_sriov: install secrets from neutron-operator; load config files from neutron.conf.d
  • Loading branch information
openshift-merge-robot authored Sep 19, 2023
2 parents 860413d + c471f69 commit bfcbeb0
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 20 deletions.
4 changes: 2 additions & 2 deletions roles/edpm_neutron_sriov/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ edpm_neutron_sriov_image: "quay.io/podified-antelope-centos9/openstack-neutron-s
edpm_neutron_sriov_common_volumes:
- /lib/modules:/lib/modules:ro
- /dev:/dev
- "{{ edpm_neutron_sriov_agent_config_dir }}:/etc/neutron:z"
- "{{ edpm_neutron_sriov_agent_config_dir }}:/etc/neutron.conf.d:z"
- /var/lib/neutron:/var/lib/neutron:shared,z
- /var/lib/kolla/config_files/neutron_sriov_agent.json:/var/lib/kolla/config_files/config.json:ro
- /var/log/containers/neutron:/var/log/neutron:z
Expand Down Expand Up @@ -56,7 +56,7 @@ edpm_neutron_sriov_rootwrap_DEFAULT_rlimit_nofile: 1024
# DEFAULT
edpm_neutron_sriov_agent_DEFAULT_state_path: '/var/lib/neutron'
# AGENT
edpm_neutron_sriov_agent_AGENT_root_helper: 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf'
edpm_neutron_sriov_agent_AGENT_root_helper: 'sudo neutron-rootwrap /etc/neutron.conf.d/01-rootwrap.conf'
edpm_neutron_sriov_agent_AGENT_report_interval: 300
edpm_neutron_sriov_agent_AGENT_extensions: 'qos'
edpm_neutron_sriov_agent_AGENT_polling_interval: 2
Expand Down
4 changes: 2 additions & 2 deletions roles/edpm_neutron_sriov/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ argument_specs:
default:
- /lib/modules:/lib/modules:ro
- /dev:/dev
- "{{ edpm_neutron_sriov_agent_config_dir }}:/etc/neutron:z"
- "{{ edpm_neutron_sriov_agent_config_dir }}:/etc/neutron.conf.d:z"
- /var/lib/neutron:/var/lib/neutron:shared,z
- /var/lib/kolla/config_files/neutron_sriov_agent.json:/var/lib/kolla/config_files/config.json:ro
- /var/log/containers/neutron:/var/log/neutron:z
Expand Down Expand Up @@ -81,7 +81,7 @@ argument_specs:
description: ''
type: str
edpm_neutron_sriov_agent_AGENT_root_helper:
default: 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf'
default: 'sudo neutron-rootwrap /etc/neutron.conf.d/01-rootwrap.conf'
description: ''
type: str
edpm_neutron_sriov_agent_AGENT_report_interval:
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_neutron_sriov/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
roles:
- role: "edpm_neutron_sriov"
vars:
edpm_neutron_sriov_DEFAULT_transport_url: "fake:/"
edpm_ovn_config_src: "{{lookup('env', 'MOLECULE_SCENARIO_DIRECTORY')}}/test-data"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[DEFAULT]
transport_url = fake:/
14 changes: 14 additions & 0 deletions roles/edpm_neutron_sriov/molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@
that:
- log_file.stat.exists
fail_msg: "File /var/log/containers/neutron/neutron-sriov-nic-agent.log does not exist"

- name: Ensure that 10-neutron-sriov.conf was copied into the container
block:
- name: sriov config file exists
become: true
ansible.builtin.stat:
path: "/var/lib/config-data/ansible-generated/neutron-sriov-agent/10-neutron-sriov.conf"
register: sriov_config

- name: assert that the config exists
ansible.builtin.assert:
that:
- sriov_config.stat.exists
fail_msg: "sriov agent config file does not exist"
51 changes: 36 additions & 15 deletions roles/edpm_neutron_sriov/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,39 @@
# License for the specific language governing permissions and limitations
# under the License.

- name: Render neutron configuration files
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ edpm_neutron_sriov_agent_config_dir }}/{{ item.dest }}"
setype: "container_file_t"
mode: "0644"
with_items:
- {"src": "neutron.conf.j2", "dest": "neutron.conf"}
- {"src": "rootwrap.conf.j2", "dest": "rootwrap.conf"}
- {"src": "neutron-sriov-agent.ini.j2", "dest": "neutron-sriov-agent.ini"}
tags:
- configure
- neutron
notify:
- restart neutron-sriov-agent
- name: Configure neutron configuration files
block:
- name: Render neutron configuration files
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ edpm_neutron_sriov_agent_config_dir }}/{{ item.dest }}"
setype: "container_file_t"
mode: "0644"
with_items:
- {"src": "neutron.conf.j2", "dest": "01-neutron.conf"}
- {"src": "rootwrap.conf.j2", "dest": "01-rootwrap.conf"}
- {"src": "neutron-sriov-agent.conf.j2", "dest": "01-neutron-sriov-agent.conf"}
tags:
- configure
- neutron
notify:
- restart neutron-sriov-agent

- name: discover secrets in {{ edpm_ovn_config_src }}
ansible.builtin.find:
paths: "{{ edpm_ovn_config_src }}"
file_type: file
recurse: yes
patterns:
- "*sriov*conf"
register: edpm_neutron_sriov_secrets
delegate_to: localhost
become: false

- name: flatten secrets into {{ edpm_neutron_sriov_agent_config_dir }}
ansible.builtin.copy:
src: "{{ item.path }}"
dest: "{{ edpm_neutron_sriov_agent_config_dir }}/{{ item.path | basename }}"
setype: "container_file_t"
mode: "0644"
with_items: "{{ edpm_neutron_sriov_secrets.files }}"

0 comments on commit bfcbeb0

Please sign in to comment.