From 84c2be40048a159fb252f9de8f2520cfe2babf76 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Tue, 24 Feb 2015 18:39:42 -0500 Subject: [PATCH] Continued work on implementing tftp service Implemented a tftp installation, and installation of the required services and changes to support iPXE. --- step1/files/xinetd.tftp | 12 ++++++++++++ step1/install.yaml | 35 ++++++++++++++++++++++++++++++---- step1/templates/ironic.conf.j2 | 12 ++++++------ 3 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 step1/files/xinetd.tftp diff --git a/step1/files/xinetd.tftp b/step1/files/xinetd.tftp new file mode 100644 index 000000000..e8568f273 --- /dev/null +++ b/step1/files/xinetd.tftp @@ -0,0 +1,12 @@ +service tftp +{ + protocol = udp + port = 69 + socket_type = dgram + wait = yes + user = root + server = /usr/sbin/in.tftpd + server_args = --map-file /tftpboot/map-file /tftpboot + disable = no + flags = IPv4 +} diff --git a/step1/install.yaml b/step1/install.yaml index 062327f2c..070ff7f41 100644 --- a/step1/install.yaml +++ b/step1/install.yaml @@ -2,15 +2,17 @@ # extend another packaging system --- - hosts: localhost + connection: local name: "Install services required for ironic" sudo: yes - gather_facts: no + gather_facts: yes # Todo: Rip vars out, refactor. vars: - driver: "abcd" - - dhcp_interface: "egfh" + - network_interface: "virbr0" - ironic_db_password: aSecretPassword473z - mysql_password: password + - testing: true tasks: - name: "Update Package Cache" local_action: apt update_cache=yes @@ -18,12 +20,17 @@ local_action: apt name={{ item }} with_items: - mysql-server - - dhcpd - - tftp-hpa + - dnsmasq - rabbitmq-server - python-pip - python-mysqldb - python-configparser + - ipxe + - tftp-hpa + - syslinux + - xinetd + - parted + - psmisc - name: "Ensuring /opt/stack is present" local_action: file name=/opt/stack state=directory owner=root group=root - name: "Downloading ironic" @@ -62,3 +69,23 @@ with_items: - { service_name: 'ironic-api', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'} - { service_name: 'ironic-conductor', username: 'ironic', args: '--config-file /etc/ironic/ironic.conf'} + - name: "Start ironic-conductor" + local_action: service name=ironic-conductor state=started + - name: "Start ironic-api" + local_action: service name=ironic-api state=started + - name: "Setting up PXE and iPXE folders" + local_action: file name={{item}} owner=ironic group=ironic state=directory + with_items: + - /tftpboot + - /tftpboot/pxelinux.cfg + - /httpboot + - name: "Placing pxelinux.0" + local_action: copy src=/usr/lib/syslinux/pxelinux.0 dest=/tftpboot + - name: "Place tftp config file" + local_action: copy src=files/xinetd.tftp dest=/etc/xinetd.d/tftp + - name: "Ensuring xinetd is running" + local_action: service name=xinetd state=started + - name: "Sending xinetd a reload signal" + local_action: service name=xinetd state=reloaded + - name: "Copy iPXE image into place" + local_action: copy src=/usr/lib/ipxe/undionly.kpxe dest=/tftpboot/ diff --git a/step1/templates/ironic.conf.j2 b/step1/templates/ironic.conf.j2 index fbf42e9cd..40d99ff88 100644 --- a/step1/templates/ironic.conf.j2 +++ b/step1/templates/ironic.conf.j2 @@ -1258,17 +1258,17 @@ connection=mysql://ironic:{{ ironic_db_password }}@localhost/ironic?charset=utf8 # IP address of Ironic compute node's tftp server. (string # value) -#tftp_server=$my_ip +tftp_server={{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }} # Ironic compute node's tftp root path. (string value) -#tftp_root=/tftpboot +tftp_root=/tftpboot # Directory where master tftp images are stored on disk. # (string value) #tftp_master_path=/tftpboot/master_images # Bootfile DHCP parameter. (string value) -#pxe_bootfile_name=pxelinux.0 +pxe_bootfile_name=undionly.kpxe # Bootfile DHCP parameter for UEFI boot mode. (string value) #uefi_pxe_bootfile_name=elilo.efi @@ -1278,13 +1278,13 @@ connection=mysql://ironic:{{ ironic_db_password }}@localhost/ironic?charset=utf8 #http_url= # Ironic compute node's HTTP root path. (string value) -#http_root=/httpboot +http_root=/httpboot # Enable iPXE boot. (boolean value) -#ipxe_enabled=false +ipxe_enabled=true # The path to the main iPXE script file. (string value) -#ipxe_boot_script=$pybasedir/drivers/modules/boot.ipxe +ipxe_boot_script=$pybasedir/drivers/modules/boot.ipxe [seamicro]