Creating a TFTP File via CURL

I have foreman-proxy and would like to create a TFTP record for a host. The
API at API - Smart Proxy - Foreman says

/tftp/00:11:22:33:44:55 POST creates pxelinux configuration file for host
with MAC address 00:11:22:33:44:55 {"syslinux_config":string}. Implicit
variant of "syslinux"I want to create a file which contains like

DEFAULT menu.c32
MENU TITLE ESXi Installer
NOHALT 1
PROMPT 0
TIMEOUT 80
LABEL install
KERNEL images/ESXiv6.5/mboot.c32
APPEND -c images/ESXiv6.5/boot.cfg
MENU LABEL ESXi-6.5.0.-4564106-full ^Installer
LABEL hddboot
LOCALBOOT 0x80
MENU LABEL ^Boot from local disk

How do I achieve this using API. I have tried

curl -k -u admin:secret -H "Accept:pplication/json" --cacert /etc/puppetlabs
/puppet/ssl/certs/ca.pem --cert /etc/puppetlabs/puppet/ssl/certs/foreman.
localdomain.pem --key /etc/puppetlabs/puppet/ssl/private_keys/foreman.
localdomain.pem -X POST https://foreman:8443/tftp/00:11:22:33:44:55 --data
@sample.json

My sample.json is like

syslinux_config=DEFAULT menu.c32
MENU TITLE Cloudsimple ESXi Installer
NOHALT 1
PROMPT 0

But this doesn't maintain the multiline format. How I achieve this ?

Wow that page has to be outdated.

Anyway:

curl -sk -X POST -d 'test' '
http://localhost:8448/tftp/syslinux/AA:BB:CC:DD:EE:FF

Read man curl for more info about how to send HTTP data.

LZ

··· On Wed, Mar 29, 2017 at 1:57 AM, Choudhury Sarada Prasanna Nanda < cspnanda@gmail.com> wrote:

I have foreman-proxy and would like to create a TFTP record for a host.
The API at http://projects.theforeman.org/projects/smart-proxy/wiki/API
says

/tftp/00:11:22:33:44:55 POST creates pxelinux configuration file for host
with MAC address 00:11:22:33:44:55 {“syslinux_config”:string}. Implicit
variant of "syslinux"I want to create a file which contains like

DEFAULT menu.c32
MENU TITLE ESXi Installer
NOHALT 1
PROMPT 0
TIMEOUT 80
LABEL install
KERNEL images/ESXiv6.5/mboot.c32
APPEND -c images/ESXiv6.5/boot.cfg
MENU LABEL ESXi-6.5.0.-4564106-full ^Installer
LABEL hddboot
LOCALBOOT 0x80
MENU LABEL ^Boot from local disk

How do I achieve this using API. I have tried

curl -k -u admin:secret -H “Accept:pplication/json” --cacert /etc/
puppetlabs/puppet/ssl/certs/ca.pem --cert /etc/puppetlabs/puppet/ssl/certs
/foreman.localdomain.pem --key /etc/puppetlabs/puppet/ssl/private_keys/
foreman.localdomain.pem -X POST https://foreman:8443/tftp/00:11:22:33:44:55
–data @sample.json

My sample.json is like

syslinux_config=DEFAULT menu.c32
MENU TITLE Cloudsimple ESXi Installer
NOHALT 1
PROMPT 0

But this doesn’t maintain the multiline format. How I achieve this ?


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


Later,
Lukas @lzap Zapletal

The method doesn't work. Can you post some examples.

··· On Wednesday, 29 March 2017 05:53:28 UTC-7, Lukas Zapletal wrote: > > Wow that page has to be outdated. > > Anyway: > > curl -sk -X POST -d 'test' ' > http://localhost:8448/tftp/syslinux/AA:BB:CC:DD:EE:FF > > Read man curl for more info about how to send HTTP data. > > LZ > > On Wed, Mar 29, 2017 at 1:57 AM, Choudhury Sarada Prasanna Nanda < > cspn...@gmail.com > wrote: > >> I have foreman-proxy and would like to create a TFTP record for a host. >> The API at http://projects.theforeman.org/projects/smart-proxy/wiki/API >> says >> >> /tftp/00:11:22:33:44:55 POST creates pxelinux configuration file for >> host with MAC address 00:11:22:33:44:55 {"syslinux_config":string}. >> Implicit variant of "syslinux"I want to create a file which contains like >> >> DEFAULT menu.c32 >> MENU TITLE ESXi Installer >> NOHALT 1 >> PROMPT 0 >> TIMEOUT 80 >> LABEL install >> KERNEL images/ESXiv6.5/mboot.c32 >> APPEND -c images/ESXiv6.5/boot.cfg >> MENU LABEL ESXi-6.5.0.-4564106-full ^Installer >> LABEL hddboot >> LOCALBOOT 0x80 >> MENU LABEL ^Boot from local disk >> >> >> How do I achieve this using API. I have tried >> >> >> curl -k -u admin:secret -H "Accept:pplication/json" --cacert /etc/ >> puppetlabs/puppet/ssl/certs/ca.pem --cert /etc/puppetlabs/puppet/ssl/ >> certs/foreman.localdomain.pem --key /etc/puppetlabs/puppet/ssl/ >> private_keys/foreman.localdomain.pem -X POST https://foreman:8443/tftp/00:11:22:33:44:55 >> --data @sample.json >> >> My sample.json is like >> >> >> syslinux_config=DEFAULT menu.c32 >> MENU TITLE Cloudsimple ESXi Installer >> NOHALT 1 >> PROMPT 0 >> ..... >> >> But this doesn't maintain the multiline format. How I achieve this ? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Foreman users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to foreman-user...@googlegroups.com . >> To post to this group, send email to forema...@googlegroups.com >> . >> Visit this group at https://groups.google.com/group/foreman-users. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Later, > Lukas @lzap Zapletal >

Actually I figured it out.

curl -k -u admin:secret -H "Accept:pplication/json" --cacert /etc/puppetlabs
/puppet/ssl/certs/ca.pem --cert /etc/puppetlabs/puppet/ssl/certs/foreman.
localdomain.pem --key /etc/puppetlabs/puppet/ssl/private_keys/foreman.
localdomain.pem -X POST https://foreman:8443/tftp/00:11:22:33:44:55 --data
"syslinux_config=cat data.json"

··· On Thursday, 30 March 2017 18:34:58 UTC-7, Choudhury Sarada Prasanna Nanda wrote: > > The method doesn't work. Can you post some examples. > > On Wednesday, 29 March 2017 05:53:28 UTC-7, Lukas Zapletal wrote: >> >> Wow that page has to be outdated. >> >> Anyway: >> >> curl -sk -X POST -d 'test' ' >> http://localhost:8448/tftp/syslinux/AA:BB:CC:DD:EE:FF >> >> Read man curl for more info about how to send HTTP data. >> >> LZ >> >> On Wed, Mar 29, 2017 at 1:57 AM, Choudhury Sarada Prasanna Nanda < >> cspn...@gmail.com> wrote: >> >>> I have foreman-proxy and would like to create a TFTP record for a host. >>> The API at http://projects.theforeman.org/projects/smart-proxy/wiki/API >>> says >>> >>> /tftp/00:11:22:33:44:55 POST creates pxelinux configuration file for >>> host with MAC address 00:11:22:33:44:55 {"syslinux_config":string}. >>> Implicit variant of "syslinux"I want to create a file which contains >>> like >>> >>> DEFAULT menu.c32 >>> MENU TITLE ESXi Installer >>> NOHALT 1 >>> PROMPT 0 >>> TIMEOUT 80 >>> LABEL install >>> KERNEL images/ESXiv6.5/mboot.c32 >>> APPEND -c images/ESXiv6.5/boot.cfg >>> MENU LABEL ESXi-6.5.0.-4564106-full ^Installer >>> LABEL hddboot >>> LOCALBOOT 0x80 >>> MENU LABEL ^Boot from local disk >>> >>> >>> How do I achieve this using API. I have tried >>> >>> >>> curl -k -u admin:secret -H "Accept:pplication/json" --cacert /etc/ >>> puppetlabs/puppet/ssl/certs/ca.pem --cert /etc/puppetlabs/puppet/ssl/ >>> certs/foreman.localdomain.pem --key /etc/puppetlabs/puppet/ssl/ >>> private_keys/foreman.localdomain.pem -X POST https://foreman:8443/tftp/00:11:22:33:44:55 >>> --data @sample.json >>> >>> My sample.json is like >>> >>> >>> syslinux_config=DEFAULT menu.c32 >>> MENU TITLE Cloudsimple ESXi Installer >>> NOHALT 1 >>> PROMPT 0 >>> ..... >>> >>> But this doesn't maintain the multiline format. How I achieve this ? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Foreman users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to foreman-user...@googlegroups.com. >>> To post to this group, send email to forema...@googlegroups.com. >>> Visit this group at https://groups.google.com/group/foreman-users. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Later, >> Lukas @lzap Zapletal >> >