Move explicit URLs in ironic-install to defaults

To facilitate offline installs, any explicit URLs should be
moved to a location where they can be easily overridden with
a local equivalent.

That way, a default install will use the canonical location, but
a user can easily override this behavior in inventory.

(Such gymnastics are not necessary for apt/yum/pip, because those
can be configured to point to local/alternate repositories independently).

** WIP - Needs *better* documentation **

Change-Id: I9dada2fe769e30abc06dac092b9f47b99969a954
Closes-Bug: #1464787
This commit is contained in:
Peter Martini 2015-06-16 22:43:15 -04:00 committed by Julia Kreger
parent f97d71368a
commit a2f468c682
6 changed files with 69 additions and 9 deletions

View File

@ -0,0 +1,52 @@
=======================
Bifrost Offline Install
=======================
The ansible scripts that compose Bifrost download and install
software via a number of means, which generally assumes connectivity
to the internet.
That connectivity is not required.
If you want or need to install Bifrost without having a dependency on
a connection to the internet, there are a number of steps that you will
need to follow (many of which may have already been done in your
environment anyway).
Those steps can be broken down into two general categories; the first being
steps that need to be done in your inventory file, and the second being
steps that need to be done on your target host outside of Ansible.
Bifrost Specific Steps
----------------------
As a general rule, any URL referenced by Bifrost scripts is configured in a
``playbook/roles/<role>/defaults/main.yml`` file, which means that all of those
can be redirected to point to a local copy by creating a file named
``playbooks/host_vars/<hostname>.yml`` and redirecting the appropriate variables.
As an example, my current file looks like:
.. code-block:: yaml
deploy_kernel_upstream_url: file:///vagrant/coreos_production_pxe.vmlinuz
deploy_ramdisk_upstream_url: file:///vagrant/coreos_production_pxe_image-oem.cpio.gz
deploy_image_upstream_url: file:///vagrant/ubuntu-14.04-server-cloudimg-amd64.tar.gz
cirros_deploy_image_upstream_url: file:///vagrant/cirros-0.3.4-x86_64-disk.img
dib_git_url: file:///vagrant/git/diskimage-builder
ironicclient_git_url: file:///vagrant/git/python-ironicclient
shade_git_url: file:///vagrant/git/shade
ironic_git_url: file:///vagrant/git/ironic
If this list becomes out of date, it's simple enough to find the things that
need to be fixed by looking for any URLs in the
``playbook/roles/<role>/defaults/main.yml`` files, as noted above.
External Steps
--------------
Bifrost doesn't attempt to configure ``apt``, ``yum``, or ``pip``, so if you are
working in an offline mode, you'll need to make sure those work independently.
``pip`` in particular will be sensitive; Bifrost tends to use the most recent
version of python modules, so you'll want to make sure your cache isn't stale.

View File

@ -25,12 +25,21 @@ latest_os_ironic_node_url: https://raw.githubusercontent.com/juliakreger/ansible
deploy_kernel: "{{http_boot_folder}}/coreos_production_pxe.vmlinuz" deploy_kernel: "{{http_boot_folder}}/coreos_production_pxe.vmlinuz"
deploy_ramdisk: "{{http_boot_folder}}/coreos_production_pxe_image-oem.cpio.gz" deploy_ramdisk: "{{http_boot_folder}}/coreos_production_pxe_image-oem.cpio.gz"
deploy_kernel_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/coreos_production_pxe.vmlinuz" deploy_kernel_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/coreos_production_pxe.vmlinuz"
deploy_kernel_upstream_url: http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe.vmlinuz
deploy_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/coreos_production_pxe_image-oem.cpio.gz" deploy_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/coreos_production_pxe_image-oem.cpio.gz"
deploy_ramdisk_upstream_url: http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe_image-oem.cpio.gz
deploy_image_filename: "trusty-server-cloudimg-amd64.img" deploy_image_filename: "trusty-server-cloudimg-amd64.img"
deploy_image_upstream_url: http://cloud-images.ubuntu.com/releases/trusty/release/ubuntu-14.04-server-cloudimg-amd64.tar.gz
deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}"
# Use cirros instead of building an image via diskimage-builder # Use cirros instead of building an image via diskimage-builder
use_cirros: false use_cirros: false
cirros_deploy_image_upstream_url: http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
# By default Bifrost will deploy dnsmasq to utilize as an integrated DHCP # By default Bifrost will deploy dnsmasq to utilize as an integrated DHCP
# server. If you already have a DHCP server, you will need to disable # server. If you already have a DHCP server, you will need to disable
# this setting, and perform manual configuration of your DHCP server. # this setting, and perform manual configuration of your DHCP server.
include_dhcp_server: true include_dhcp_server: true
# *_git_url can be overridden by local clones for offline installs
dib_git_url: https://git.openstack.org/openstack/diskimage-builder
ironicclient_git_url: https://review.openstack.org/openstack/python-ironicclient
shade_git_url: https://review.openstack.org/openstack-infra/shade
ironic_git_url: https://git.openstack.org/openstack/ironic

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
--- ---
- name: "DIB - Retrieving diskimage-builder from git.openstack.org" - name: "DIB - Retrieving diskimage-builder from git.openstack.org"
command: git clone https://git.openstack.org/openstack/diskimage-builder chdir=/opt/stack creates=/opt/stack/diskimage-builder command: git clone {{ dib_git_url }} chdir=/opt/stack creates=/opt/stack/diskimage-builder
- name: "DIB - Checking out master branch" - name: "DIB - Checking out master branch"
command: git checkout -f master chdir=/opt/stack/diskimage-builder command: git checkout -f master chdir=/opt/stack/diskimage-builder
- name: "DIB- Resetting local repository" - name: "DIB- Resetting local repository"

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
--- ---
- name: "python-ironicclient - Retrieving library from git.openstack.org" - name: "python-ironicclient - Retrieving library from git.openstack.org"
command: git clone https://review.openstack.org/openstack/python-ironicclient chdir=/opt/stack creates=/opt/stack/python-ironicclient command: git clone {{ ironicclient_git_url }} chdir=/opt/stack creates=/opt/stack/python-ironicclient
- name: "python-ironicclient - Checking out master branch" - name: "python-ironicclient - Checking out master branch"
command: git checkout -f master chdir=/opt/stack/python-ironicclient command: git checkout -f master chdir=/opt/stack/python-ironicclient
- name: "python-ironicclient - Resetting local repository" - name: "python-ironicclient - Resetting local repository"

View File

@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
--- ---
- name: Include OS-specific packages variables. - name: Include OS-specific packages variables.
include_vars: "{{ item }}" include_vars: "{{ item }}"
with_first_found: with_first_found:
@ -34,7 +33,7 @@
- name: "Ensuring /opt/stack is present" - name: "Ensuring /opt/stack is present"
file: name=/opt/stack state=directory owner=root group=root file: name=/opt/stack state=directory owner=root group=root
- name: "Downloading Ironic" - name: "Downloading Ironic"
command: git clone https://git.openstack.org/openstack/ironic chdir=/opt/stack creates=/opt/stack/ironic command: git clone {{ ironic_git_url }} chdir=/opt/stack creates=/opt/stack/ironic
- name: "Ironic - checking out master branch" - name: "Ironic - checking out master branch"
command: git checkout -f master chdir=/opt/stack/ironic command: git checkout -f master chdir=/opt/stack/ironic
- name: "Ironic - resetting master branch" - name: "Ironic - resetting master branch"
@ -237,22 +236,22 @@
stat: path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz stat: path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz
register: test_core_os_kernel_present register: test_core_os_kernel_present
- name: "Download CoreOS kernel" - name: "Download CoreOS kernel"
get_url: url=http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe.vmlinuz dest={{ http_boot_folder }}/coreos_production_pxe.vmlinuz get_url: url={{ deploy_kernel_upstream_url }} dest={{ http_boot_folder }}/coreos_production_pxe.vmlinuz
when: test_core_os_kernel_present.stat.exists == false when: test_core_os_kernel_present.stat.exists == false
- name: "Test if CoreOS image is present" - name: "Test if CoreOS image is present"
stat: path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz stat: path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz
register: test_core_os_image_present register: test_core_os_image_present
- name: "Download CoreOS image" - name: "Download CoreOS image"
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 get_url: url={{ deploy_ramdisk_upstream_url }} dest={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz
when: test_core_os_image_present.stat.exists == false when: test_core_os_image_present.stat.exists == false
- name: "Download cirros to use for deployment if requested" - name: "Download cirros to use for deployment if requested"
get_url: url=http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img dest="{{deploy_image}}" get_url: url={{ cirros_deploy_image_upstream_url }} dest="{{ deploy_image }}"
when: "{{use_cirros|bool}}" when: "{{use_cirros|bool}}"
- name: "Test if Ubuntu 14.04 server cloud amd64 is present" - name: "Test if Ubuntu 14.04 server cloud amd64 is present"
stat: path={{ deploy_image }} stat: path={{ deploy_image }}
register: test_os_image_present register: test_os_image_present
- name: "Download Ubuntu image" - name: "Download Ubuntu image"
get_url: url=http://cloud-images.ubuntu.com/releases/trusty/release/ubuntu-14.04-server-cloudimg-amd64.tar.gz dest=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz get_url: url={{ deploy_image_upstream_url }} dest=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz
when: test_os_image_present.stat.exists == false and create_image_via_dib == false when: test_os_image_present.stat.exists == false and create_image_via_dib == false
- name: "Extract Ubuntu image" - name: "Extract Ubuntu image"
unarchive: src=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz dest=/httpboot/ creates=/httpboot/trusty-server-cloudimg-amd64.img unarchive: src=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz dest=/httpboot/ creates=/httpboot/trusty-server-cloudimg-amd64.img

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
--- ---
- name: "Shade - Retrieving library from git.openstack.org" - name: "Shade - Retrieving library from git.openstack.org"
command: git clone https://review.openstack.org/openstack-infra/shade chdir=/opt/stack creates=/opt/stack/shade command: git clone {{ shade_git_url }} chdir=/opt/stack creates=/opt/stack/shade
- name: "Shade - Checking out master branch" - name: "Shade - Checking out master branch"
command: git checkout -f master chdir=/opt/stack/shade command: git checkout -f master chdir=/opt/stack/shade
- name: "Shade - Resetting local repository" - name: "Shade - Resetting local repository"