-
Notifications
You must be signed in to change notification settings - Fork 37
TFTP feature #533
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
base: master
Are you sure you want to change the base?
TFTP feature #533
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| --- | ||
| help: | | ||
| Setup TFTP server | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| - name: TFTP | ||
| hosts: | ||
| - quadlet | ||
| become: true | ||
| tasks: | ||
| - name: Install packages | ||
| ansible.builtin.package: | ||
| name: | ||
| - tftp-server | ||
| - tftp | ||
| state: present | ||
|
|
||
| - name: Start TFTP services | ||
| ansible.builtin.systemd: | ||
| name: "{{ item }}" | ||
| state: started | ||
| enabled: true | ||
| with_items: | ||
| - tftp.socket | ||
| - tftp.service |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,13 +56,21 @@ variables: | |
| parameter: --bmc-redfish-verify-ssl | ||
| help: Verify SSL certificates for Redfish BMC connections. | ||
| type: Boolean | ||
| foreman_proxy_tftp_root: | ||
| parameter: --tftp-root | ||
| help: Directory to serve TFTP files from. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ewouds comment in jira made me realize that this description is wrong. It is unclear to me how the HTTPBoot thing obtains the files (seems there is no code for that), so maybe it relies on the TFTP module to place the files and just exposes them over HTTP instead of TFTP? (This is not blocking the feature here, just food for further thought going forward)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also faced similar doubts while just scaffolding httpboot feature, and i realised its use
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You may find theforeman/smart-proxy@db33bc6 interesting. Perhaps we should call it the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "interesting" as in "wait, what!?"? ;-) How is the directory populated, when the TFTP feature is off, but HTTPBoot is on?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Magic? In theforeman/puppet-foreman_proxy@e4b7763 I wrote:
It was a long discussion that was rather tedious. I'm not sure the whole use case of netbooting with HTTPBoot without TFTP was ever really well supported.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
AFAIK, no population happens, just configuration, As of today, by default httpboot enablement will add :root_dir: /var/lib/tftpboot in config, and still be indirectly dependent on tftp to create and populate that directory |
||
| type: AbsolutePath | ||
| foreman_proxy_tftp_servername: | ||
| parameter: --tftp-servername | ||
| help: Server name or IP address for TFTP. TFTP clients typically do not have DNS available, so an IP address is recommended. | ||
|
|
||
| constraints: | ||
| required_together: | ||
| - [certificates_custom_server_certificate, certificates_custom_server_key, certificates_custom_server_ca_certificate] | ||
| forbidden_if: | ||
| - [certificates_source, installer, [certificates_custom_server_certificate, certificates_custom_server_key, certificates_custom_server_ca_certificate]] | ||
|
|
||
| required_in_list: | ||
| - [[[features, tftp]], [foreman_proxy_tftp_servername]] | ||
|
|
||
| include: | ||
| - _certificate_source | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| - name: TFTP root directory | ||
| notify: | ||
| - Restart Foreman Proxy | ||
| - Refresh Foreman Proxy | ||
| block: | ||
| - name: Create TFTP root directory | ||
| ansible.builtin.file: | ||
| path: "{{ foreman_proxy_tftp_root }}" | ||
| state: directory | ||
| mode: "0777" | ||
|
|
||
| - name: Mount the directory into foreman-proxy container | ||
| ansible.builtin.copy: | ||
| dest: /etc/containers/systemd/foreman-proxy.container.d/tftp-root.conf | ||
| content: | | ||
| [Container] | ||
| Volume={{ foreman_proxy_tftp_root }}:/var/lib/tftpboot:rw | ||
| mode: '0644' | ||
| owner: root | ||
| group: root |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| :enabled: {{ feature_enabled }} | ||
| :tftproot: /var/lib/tftpboot | ||
| :tftp_servername: {{ foreman_proxy_tftp_servername }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |||||
| from requests.adapters import HTTPAdapter | ||||||
|
|
||||||
| SSH_CONFIG = './.tmp/ssh-config' | ||||||
| FOREMAN_PROXY_PORT = 8443 | ||||||
|
|
||||||
|
|
||||||
| class UserParameters: | ||||||
|
|
@@ -268,6 +269,28 @@ def get_connection_with_tls_context(self, request, verify, proxies=None, cert=No | |||||
| return conn | ||||||
|
|
||||||
|
|
||||||
| @pytest.fixture(scope="module") | ||||||
| def proxy_request(server, certificates, server_fqdn): | ||||||
|
stejskalleos marked this conversation as resolved.
|
||||||
| port = FOREMAN_PROXY_PORT | ||||||
|
|
||||||
| def _request(path, method=None, data=None, return_body=False): | ||||||
| curl_opts = ( | ||||||
| f"--cacert {certificates['server_ca_certificate']} " | ||||||
| f"--cert {certificates['client_certificate']} " | ||||||
| f"--key {certificates['client_key']} " | ||||||
| f"--silent " | ||||||
| ) | ||||||
| if not return_body: | ||||||
| curl_opts += "--output /dev/null --write-out '%{http_code}' " | ||||||
| if method: | ||||||
| curl_opts += f"-X {method} " | ||||||
| if data: | ||||||
| curl_opts += f"-d '{data}' " | ||||||
| return server.run(f"curl {curl_opts}https://{server_fqdn}:{port}/{path}") | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
then you don't need to do |
||||||
|
|
||||||
| return _request | ||||||
|
|
||||||
|
|
||||||
| @pytest.fixture(scope="module") | ||||||
| def local_request(ssh_config, server_fqdn): | ||||||
| session = requests.Session() | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.