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.
This commit is contained in:
Julia Kreger 2015-02-25 18:33:11 -05:00
parent cd06e26e84
commit e53131c071
6 changed files with 32 additions and 9 deletions

View File

@ -5,7 +5,7 @@ Deets on the etherpad for now:
Step 1: Step 1:
cd step1 1. cd step1
bash ./env-setup.sh 2. bash ./env-setup.sh
source /opt/stack/ansible/hacking/env-setup 3. source /opt/stack/ansible/hacking/env-setup
ansible-playbook -vvvv -i localhost ./install.yaml 4. ansible-playbook -vvvv -i loca1host ./install.yaml

View File

@ -12,4 +12,4 @@ fi
echo echo
echo "source /opt/stack/ansible/hacking/env-setup to proceed" echo "source /opt/stack/ansible/hacking/env-setup to proceed"
export IRONIC_URL=http://localhost:6385/ export IRONIC_URL=http://localhost:6385/
export OS_AUTH_TOJEN=' ' export OS_AUTH_TOKEN=' '

View File

@ -12,6 +12,7 @@
- ironic_db_password: aSecretPassword473z - ironic_db_password: aSecretPassword473z
- mysql_password: password - mysql_password: password
- testing: true - testing: true
- http_boot_folder: /httpboot
tasks: tasks:
- name: "Update Package Cache" - name: "Update Package Cache"
local_action: apt update_cache=yes local_action: apt update_cache=yes
@ -100,7 +101,7 @@
with_items: with_items:
- /tftpboot - /tftpboot
- /tftpboot/pxelinux.cfg - /tftpboot/pxelinux.cfg
- /httpboot - "{{ http_boot_folder }}"
- name: "Placing pxelinux.0" - name: "Placing pxelinux.0"
local_action: copy src=/usr/lib/syslinux/pxelinux.0 dest=/tftpboot local_action: copy src=/usr/lib/syslinux/pxelinux.0 dest=/tftpboot
- name: "Place tftp config file" - name: "Place tftp config file"
@ -129,6 +130,8 @@
name: "Retrieve Images" name: "Retrieve Images"
sudo: yes sudo: yes
gather_facts: yes gather_facts: yes
vars:
- http_boot_folder: /httpboot
tasks: tasks:
# Similar logic to below can be utilized to retrieve files # Similar logic to below can be utilized to retrieve files
- name: "Determine if folder exists, else create and populate folder." - name: "Determine if folder exists, else create and populate folder."
@ -137,3 +140,23 @@
- name: "Create master_images folder" - name: "Create master_images folder"
local_action: file name=/tftpboot/master_images state=directory local_action: file name=/tftpboot/master_images state=directory
when: test_master_images.stat.exists == false 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

View File

@ -7,7 +7,7 @@
# Listen on this specific port instead of the standard DNS port # Listen on this specific port instead of the standard DNS port
# (53). Setting this to zero completely disables DNS function, # (53). Setting this to zero completely disables DNS function,
# leaving only DHCP and/or TFTP. # leaving only DHCP and/or TFTP.
port=0 port=53
# The following two options make you a better netizen, since they # The following two options make you a better netizen, since they
# tell dnsmasq to filter out queries which the public DNS cannot # tell dnsmasq to filter out queries which the public DNS cannot

View File

@ -1281,7 +1281,7 @@ pxe_bootfile_name=undionly.kpxe
http_url=http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:8080/ http_url=http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:8080/
# Ironic compute node's HTTP root path. (string value) # Ironic compute node's HTTP root path. (string value)
http_root=/httpboot http_root={{ http_boot_folder }}
# Enable iPXE boot. (boolean value) # Enable iPXE boot. (boolean value)
ipxe_enabled=true ipxe_enabled=true

View File

@ -45,5 +45,5 @@ http {
server { server {
listen 8000; listen 8000;
server_name {{ ansible_hostname }}; server_name {{ ansible_hostname }};
root /httpboot; root {{ http_boot_folder }};
} }