From e53131c071068a2762efe862b0de3a4c1fa180d2 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Wed, 25 Feb 2015 18:33:11 -0500 Subject: [PATCH] File Downloads for CoreOS and Ubuntu and misc fixes Added file download support along with an automatic skip if the file is already present, and semi-configurable httpboot folder path. Corrected minor typo in env-setup.sh. --- README.rst | 8 ++++---- step1/env-setup.sh | 2 +- step1/install.yaml | 25 ++++++++++++++++++++++++- step1/templates/dnsmasq.conf.j2 | 2 +- step1/templates/ironic.conf.j2 | 2 +- step1/templates/nginx.conf.j2 | 2 +- 6 files changed, 32 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 495f4a626..ef40f2355 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ Deets on the etherpad for now: Step 1: - cd step1 - bash ./env-setup.sh - source /opt/stack/ansible/hacking/env-setup - ansible-playbook -vvvv -i localhost ./install.yaml +1. cd step1 +2. bash ./env-setup.sh +3. source /opt/stack/ansible/hacking/env-setup +4. ansible-playbook -vvvv -i loca1host ./install.yaml diff --git a/step1/env-setup.sh b/step1/env-setup.sh index d8b4a1125..4697b3213 100644 --- a/step1/env-setup.sh +++ b/step1/env-setup.sh @@ -12,4 +12,4 @@ fi echo echo "source /opt/stack/ansible/hacking/env-setup to proceed" export IRONIC_URL=http://localhost:6385/ -export OS_AUTH_TOJEN=' ' +export OS_AUTH_TOKEN=' ' diff --git a/step1/install.yaml b/step1/install.yaml index 4cbde55f8..dbaa60165 100644 --- a/step1/install.yaml +++ b/step1/install.yaml @@ -12,6 +12,7 @@ - ironic_db_password: aSecretPassword473z - mysql_password: password - testing: true + - http_boot_folder: /httpboot tasks: - name: "Update Package Cache" local_action: apt update_cache=yes @@ -100,7 +101,7 @@ with_items: - /tftpboot - /tftpboot/pxelinux.cfg - - /httpboot + - "{{ http_boot_folder }}" - name: "Placing pxelinux.0" local_action: copy src=/usr/lib/syslinux/pxelinux.0 dest=/tftpboot - name: "Place tftp config file" @@ -129,6 +130,8 @@ name: "Retrieve Images" sudo: yes gather_facts: yes + vars: + - http_boot_folder: /httpboot tasks: # Similar logic to below can be utilized to retrieve files - name: "Determine if folder exists, else create and populate folder." @@ -137,3 +140,23 @@ - name: "Create master_images folder" local_action: file name=/tftpboot/master_images state=directory when: test_master_images.stat.exists == false + # This is overly complex, however get_url will always re-retrieve the file + # if it already exists, and this is to prevent that behavior. + - name: "Test if CoreOS kernel is present" + local_action: stat path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz + register: test_core_os_kernel_present + - name: "Download CoreOS kernel" + local_action: get_url url=http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe.vmlinuz dest={{ http_boot_folder }}/coreos_production_pxe.vmlinuz + when: test_core_os_kernel_present.stat.exists == false + - name: "Test if CoreOS image is present" + local_action: stat path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz + register: test_core_os_image_present + - name: "Download CoreOS image" + local_action: get_url url=http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe_image-oem.cpio.gz dest={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz + when: test_core_os_image_present.stat.exists == false + - name: "Test if Ubuntu 14.04 server cloud amd64 is present" + local_action: stat path={{ http_boot_folder }}/ubuntu-14.04-server-cloudimg-amd64.tar.gz + register: test_core_os_image_present + - name: "Download CoreOS image" + local_action: get_url url=http://cloud-images.ubuntu.com/releases/trusty/release/ubuntu-14.04-server-cloudimg-amd64.tar.gz dest={{ http_boot_folder }}/ubuntu-14.04-server-cloudimg-amd64.tar.gz + when: test_core_os_image_present.stat.exists == false diff --git a/step1/templates/dnsmasq.conf.j2 b/step1/templates/dnsmasq.conf.j2 index e46fd14ee..728ad9ee8 100644 --- a/step1/templates/dnsmasq.conf.j2 +++ b/step1/templates/dnsmasq.conf.j2 @@ -7,7 +7,7 @@ # Listen on this specific port instead of the standard DNS port # (53). Setting this to zero completely disables DNS function, # leaving only DHCP and/or TFTP. -port=0 +port=53 # The following two options make you a better netizen, since they # tell dnsmasq to filter out queries which the public DNS cannot diff --git a/step1/templates/ironic.conf.j2 b/step1/templates/ironic.conf.j2 index e61d455c3..6339fcd10 100644 --- a/step1/templates/ironic.conf.j2 +++ b/step1/templates/ironic.conf.j2 @@ -1281,7 +1281,7 @@ pxe_bootfile_name=undionly.kpxe http_url=http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:8080/ # Ironic compute node's HTTP root path. (string value) -http_root=/httpboot +http_root={{ http_boot_folder }} # Enable iPXE boot. (boolean value) ipxe_enabled=true diff --git a/step1/templates/nginx.conf.j2 b/step1/templates/nginx.conf.j2 index 0dd4f95bc..3c98e410e 100644 --- a/step1/templates/nginx.conf.j2 +++ b/step1/templates/nginx.conf.j2 @@ -45,5 +45,5 @@ http { server { listen 8000; server_name {{ ansible_hostname }}; - root /httpboot; + root {{ http_boot_folder }}; }