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

inspector: Add support for copying known_devices.yaml #607

Merged
merged 1 commit into from
Sep 6, 2024
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
26 changes: 26 additions & 0 deletions ansible/roles/ironic/tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,32 @@
when:
- ironic_inspector_policy.results

- name: Check if Ironic Inspector known_devices.yaml shall be overwritten
stat:
path: "{{ node_custom_config }}/ironic-inspector/known_devices.yaml"
delegate_to: localhost
run_once: True
register: ironic_inspector_known_devices

- name: Set known_devices file path
set_fact:
ironic_inspector_known_devices_file_path: "{{ ironic_inspector_known_devices.stat.path }}"
when:
- ironic_inspector_known_devices.stat.exists

- name: Copying over known_devices.yaml
template:
src: "{{ ironic_inspector_known_devices_file_path }}"
dest: "{{ node_config_directory }}/ironic-inspector/known_devices.yaml"
mode: "0660"
become: true
when:
- ironic_inspector_known_devices_file_path is defined
- inventory_hostname in groups["ironic-inspector"]
- ironic_services["ironic-inspector"].enabled | bool
notify:
- "Restart ironic-inspector container"

- include_tasks: copy-certs.yml
when:
- kolla_copy_ca_into_containers | bool or ironic_enable_tls_backend | bool
Expand Down
6 changes: 6 additions & 0 deletions ansible/roles/ironic/templates/ironic-inspector.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"dest": "/etc/ironic-inspector/{{ ironic_inspector_policy_file }}",
"owner": "ironic-inspector",
"perm": "0600"
}{% endif %}{% if ironic_inspector_known_devices_file_path is defined %},
{
"source": "{{ container_config_directory }}/known_devices.yaml",
"dest": "/etc/ironic-inspector/known_devices.yaml",
"owner": "ironic-inspector",
"perm": "0600"
}{% endif %}
]
}