From 9f5608fbad73ceade26ef80fe2acde666e63960a Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Fri, 22 Jan 2016 16:41:50 -0500 Subject: [PATCH] Rename of the nginx_port variable The nginx_port variable is insufficiently generic enough in the event a user really wanted to run Apache, or some other web server. As such, this commit renames the setting to file_url_port to prevent any confusion meanwhile supporting the ability to continue to use an override setting should the variable nginx_port be defined in an externally generated variable setting file. Change-Id: Ida88cdec6ba162920df09dbdd335a9ad7868c842 --- playbooks/inventory/group_vars/baremetal | 6 +++--- playbooks/inventory/group_vars/localhost | 6 +++--- .../roles/bifrost-deploy-nodes-dynamic/defaults/main.yml | 4 +++- .../roles/bifrost-deploy-nodes-dynamic/tasks/main.yml | 6 +++--- playbooks/roles/bifrost-ironic-install/defaults/main.yml | 8 +++++--- .../roles/bifrost-ironic-install/tasks/ironic_config.yml | 2 +- playbooks/roles/bifrost-ironic-install/tasks/main.yml | 8 +++++++- .../bifrost-ironic-install/templates/dnsmasq.conf.j2 | 4 ++-- .../templates/inspector-default-boot-ipxe.j2 | 4 ++-- .../roles/bifrost-ironic-install/templates/nginx.conf.j2 | 2 +- playbooks/roles/ironic-enroll-dynamic/defaults/main.yml | 9 +++++---- 11 files changed, 35 insertions(+), 24 deletions(-) diff --git a/playbooks/inventory/group_vars/baremetal b/playbooks/inventory/group_vars/baremetal index 32e65c941..ef434ba1c 100644 --- a/playbooks/inventory/group_vars/baremetal +++ b/playbooks/inventory/group_vars/baremetal @@ -19,15 +19,15 @@ testing_user: root # The default port to download files via. Required for IPA URL generation. # Presently the defaults are located in the roles, however if changed both # the localhost and baremetal group files must be updated. -# nginx_port: 8080 +# file_url_port: 8080 # IPA Image parameters. If these are changed, they must be changed in # Both localhost and baremetal groups. Presently the defaults # in each role should be sufficent for proper operation. # ipa_kernel: "{{http_boot_folder}}/coreos_production_pxe.vmlinuz" # ipa_ramdisk: "{{http_boot_folder}}/coreos_production_pxe_image-oem.cpio.gz" -# ipa_kernel_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/coreos_production_pxe.vmlinuz" -# ipa_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/coreos_production_pxe_image-oem.cpio.gz" +# ipa_kernel_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{file_url_port}}/coreos_production_pxe.vmlinuz" +# ipa_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{file_url_port}}/coreos_production_pxe_image-oem.cpio.gz" # The http_boot_folder defines the root folder for the webserver. # If this setting is changed, it must be applied to both the baremetal diff --git a/playbooks/inventory/group_vars/localhost b/playbooks/inventory/group_vars/localhost index 01eec7dea..ef062836e 100644 --- a/playbooks/inventory/group_vars/localhost +++ b/playbooks/inventory/group_vars/localhost @@ -26,15 +26,15 @@ mysql_password: # The default port to download files via. Required for IPA URL generation. # Presently the defaults are located in the roles, however if changed both # the localhost and baremetal group files must be updated. -# nginx_port: 8080 +# file_url_port: 8080 # IPA Image parameters. If these are changed, they must be changed in # Both localhost and baremetal groups. Presently the defaults # in each role should be sufficent for proper operation. # ipa_kernel: "{{http_boot_folder}}/coreos_production_pxe.vmlinuz" # ipa_ramdisk: "{{http_boot_folder}}/coreos_production_pxe_image-oem.cpio.gz" -# ipa_kernel_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/coreos_production_pxe.vmlinuz" -# ipa_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/coreos_production_pxe_image-oem.cpio.gz" +# ipa_kernel_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{file_url_port}}/coreos_production_pxe.vmlinuz" +# ipa_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{file_url_port}}/coreos_production_pxe_image-oem.cpio.gz" # The http_boot_folder defines the root folder for the webserver. # If this setting is changed, it must be applied to both the baremetal diff --git a/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml b/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml index 3283f44f3..759aedf6a 100644 --- a/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml @@ -1,7 +1,9 @@ --- # defaults file for bifrost-deploy-nodes-dynamic ironic_url: "http://localhost:6385/" -nginx_port: 8080 +# Deprecated: nginx_port is no longer used and file_url_port should +# be used instead. +file_url_port: "{{ nginx_port | default('8080') }}" network_interface: "virbr0" ans_network_interface: "{{ network_interface | replace('-', '_') }}" http_boot_folder: "/httpboot" diff --git a/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml b/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml index 9b7a79fea..b2e4fd64f 100644 --- a/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml +++ b/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml @@ -45,7 +45,7 @@ ironic_url: "{{ ironic_url }}" uuid: "{{ uuid }}" state: present - config_drive: "{{ deploy_url_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ nginx_port }}/configdrive-{{ uuid }}.iso.gz" + config_drive: "{{ deploy_url_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/configdrive-{{ uuid }}.iso.gz" instance_info: "{{ instance_info }}" delegate_to: localhost when: instance_info is defined and instance_info | to_json != '{}' @@ -63,9 +63,9 @@ ironic_url: "{{ ironic_url }}" uuid: "{{ uuid }}" state: present - config_drive: "{{ deploy_url_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ nginx_port }}/configdrive-{{ uuid }}.iso.gz" + config_drive: "{{ deploy_url_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/configdrive-{{ uuid }}.iso.gz" instance_info: - image_source: "{{ deploy_url_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ nginx_port }}/{{deploy_image_filename}}" + image_source: "{{ deploy_url_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/{{deploy_image_filename}}" image_checksum: "{{ test_deploy_image.stat.md5 }}" image_disk_format: "qcow2" root_gb: 10 diff --git a/playbooks/roles/bifrost-ironic-install/defaults/main.yml b/playbooks/roles/bifrost-ironic-install/defaults/main.yml index fe492db8c..77d87ec05 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/main.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/main.yml @@ -3,7 +3,9 @@ # which causes the nodes to be wiped after deletion. cleaning: false http_boot_folder: /httpboot -nginx_port: 8080 +# Deprecated: nginx_port is no longer used and file_url_port should +# be used instead. +file_url_port: "{{ nginx_port | default('8080') }}" ironicclient_source_install: false shade_source_install: true # Setting to utilize diskimage-builder to create a bootable image. @@ -29,9 +31,9 @@ ipa_file_protocol: "http" ipa_kernel: "{{http_boot_folder}}/ipa.vmlinuz" ipa_ramdisk: "{{http_boot_folder}}/ipa.initramfs" -ipa_kernel_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{nginx_port}}/ipa.vmlinuz" +ipa_kernel_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{file_url_port}}/ipa.vmlinuz" ipa_kernel_upstream_url: http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe.vmlinuz -ipa_ramdisk_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{nginx_port}}/ipa.initramfs" +ipa_ramdisk_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{file_url_port}}/ipa.initramfs" ipa_ramdisk_upstream_url: http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe_image-oem.cpio.gz deploy_image_filename: "deployment_image.qcow2" deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" diff --git a/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml b/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml index 4f3744e78..f74332a5b 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/ironic_config.yml @@ -128,7 +128,7 @@ dest=/etc/ironic/ironic.conf insertafter="[pxe]" regexp='^(.*)http_url=(.*)$' - line="http_url=http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{nginx_port}}/" + line="http_url=http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/" - name: "Set iPXE http_root" lineinfile: dest=/etc/ironic/ironic.conf diff --git a/playbooks/roles/bifrost-ironic-install/tasks/main.yml b/playbooks/roles/bifrost-ironic-install/tasks/main.yml index 5eba04c84..ef16288eb 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/main.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/main.yml @@ -32,6 +32,12 @@ - "../defaults/required_defaults_{{ ansible_distribution }}_{{ansible_distribution_release }}.yml" - "../defaults/required_defaults_{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml" - "../defaults/dummy-defaults.yml" +- name: "Warn if deprecated variable nginx_port is set" + debug: + msg: > + WARNING - nginx_port is a deprecated variable and support will be + removed during the Newton cycle. + when: nginx_port is defined - name: "Update Package Cache" apt: update_cache=yes when: ansible_os_family == 'Debian' @@ -370,7 +376,7 @@ "Explicitly permit nginx port (TCP) for file downloads from nodes to be provisioned" command: > - iptables -I INPUT -p tcp --dport {{nginx_port}} + iptables -I INPUT -p tcp --dport {{file_url_port}} -i {{network_interface}} -j ACCEPT - name: "Explicitly permit TCP/6385 for IPA callback" command: > diff --git a/playbooks/roles/bifrost-ironic-install/templates/dnsmasq.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/dnsmasq.conf.j2 index 637241353..75f6e89e2 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/dnsmasq.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/dnsmasq.conf.j2 @@ -87,9 +87,9 @@ dhcp-boot=tag:gpxe,/ipxe.pxe dhcp-match=set:ipxe,175 # iPXE sends a 175 option. dhcp-boot=tag:!ipxe,/undionly.kpxe {% if testing %} -dhcp-boot=http://192.168.122.1:{{nginx_port}}/boot.ipxe +dhcp-boot=http://192.168.122.1:{{ file_url_port }}/boot.ipxe {% else %} -dhcp-boot=http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{nginx_port}}/boot.ipxe +dhcp-boot=http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/boot.ipxe {% endif %} {% if testing %} diff --git a/playbooks/roles/bifrost-ironic-install/templates/inspector-default-boot-ipxe.j2 b/playbooks/roles/bifrost-ironic-install/templates/inspector-default-boot-ipxe.j2 index c4bf731a1..e2918cc02 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/inspector-default-boot-ipxe.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/inspector-default-boot-ipxe.j2 @@ -5,6 +5,6 @@ dhcp goto introspect :introspect -kernel http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{ nginx_port }}/ipa.vmlinuz ipa-inspection-callback-url=http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:5050/v1/continue systemd.journald.forward_to_console=yes ip=${ip}:${next-server}:${gateway}:${netmask} BOOTIF=${mac} nofb nomodeset vga=normal console=ttyS0 -initrd http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{ nginx_port }}/ipa.initramfs +kernel http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{ file_url_port }}/ipa.vmlinuz ipa-inspection-callback-url=http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:5050/v1/continue systemd.journald.forward_to_console=yes ip=${ip}:${next-server}:${gateway}:${netmask} BOOTIF=${mac} nofb nomodeset vga=normal console=ttyS0 +initrd http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{ file_url_port }}/ipa.initramfs boot diff --git a/playbooks/roles/bifrost-ironic-install/templates/nginx.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/nginx.conf.j2 index e627a84d0..bd9709e7b 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/nginx.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/nginx.conf.j2 @@ -40,7 +40,7 @@ http { gzip on; server { - listen {{nginx_port}}; + listen {{ file_url_port }}; server_name {{ ansible_hostname }}; root {{ http_boot_folder }}; location {{ http_boot_folder }}/ { diff --git a/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml b/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml index 23857665b..467149d3e 100644 --- a/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml +++ b/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml @@ -1,7 +1,8 @@ --- ironic_url: "http://localhost:6385/" -nginx_port: 8080 - +# Deprecated: nginx_port is no longer used and file_url_port should +# be used instead. +file_url_port: "{{ nginx_port | default('8080') }}" # Default network interface that bifrost will be attached to. network_interface: "virbr0" ans_network_interface: "{{ network_interface | replace('-', '_') }}" @@ -13,7 +14,7 @@ ans_network_interface: "{{ network_interface | replace('-', '_') }}" # documentation at http://ipxe.org/crypto ipa_file_protocol: "http" -ipa_kernel_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{nginx_port}}/ipa.vmlinuz" -ipa_ramdisk_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{nginx_port}}/ipa.initramfs" +ipa_kernel_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{file_url_port}}/ipa.vmlinuz" +ipa_ramdisk_url: "{{ ipa_file_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{file_url_port}}/ipa.initramfs" noauth_mode: true