From a2f468c682e23ca16389c647dfabaf4f65ec1aa6 Mon Sep 17 00:00:00 2001 From: Peter Martini Date: Tue, 16 Jun 2015 22:43:15 -0400 Subject: [PATCH] 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 --- doc/source/offline-install.rst | 52 +++++++++++++++++++ .../roles/ironic-install/defaults/main.yml | 9 ++++ .../ironic-install/tasks/dib_install.yml | 2 +- .../tasks/ironicclient_source_install.yml | 2 +- playbooks/roles/ironic-install/tasks/main.yml | 11 ++-- .../tasks/shade_source_install.yml | 2 +- 6 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 doc/source/offline-install.rst diff --git a/doc/source/offline-install.rst b/doc/source/offline-install.rst new file mode 100644 index 000000000..97907f576 --- /dev/null +++ b/doc/source/offline-install.rst @@ -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//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/.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//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. diff --git a/playbooks/roles/ironic-install/defaults/main.yml b/playbooks/roles/ironic-install/defaults/main.yml index 380bd4004..ef2fa45e4 100644 --- a/playbooks/roles/ironic-install/defaults/main.yml +++ b/playbooks/roles/ironic-install/defaults/main.yml @@ -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_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_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_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_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}}" # Use cirros instead of building an image via diskimage-builder 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 # server. If you already have a DHCP server, you will need to disable # this setting, and perform manual configuration of your DHCP server. 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 diff --git a/playbooks/roles/ironic-install/tasks/dib_install.yml b/playbooks/roles/ironic-install/tasks/dib_install.yml index 6a0d24d5b..f1f1a0a40 100644 --- a/playbooks/roles/ironic-install/tasks/dib_install.yml +++ b/playbooks/roles/ironic-install/tasks/dib_install.yml @@ -14,7 +14,7 @@ # limitations under the License. --- - 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" command: git checkout -f master chdir=/opt/stack/diskimage-builder - name: "DIB- Resetting local repository" diff --git a/playbooks/roles/ironic-install/tasks/ironicclient_source_install.yml b/playbooks/roles/ironic-install/tasks/ironicclient_source_install.yml index 62b2c1be5..16fe819e8 100644 --- a/playbooks/roles/ironic-install/tasks/ironicclient_source_install.yml +++ b/playbooks/roles/ironic-install/tasks/ironicclient_source_install.yml @@ -14,7 +14,7 @@ # limitations under the License. --- - 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" command: git checkout -f master chdir=/opt/stack/python-ironicclient - name: "python-ironicclient - Resetting local repository" diff --git a/playbooks/roles/ironic-install/tasks/main.yml b/playbooks/roles/ironic-install/tasks/main.yml index 0e9017ab3..329765151 100644 --- a/playbooks/roles/ironic-install/tasks/main.yml +++ b/playbooks/roles/ironic-install/tasks/main.yml @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. --- - - name: Include OS-specific packages variables. include_vars: "{{ item }}" with_first_found: @@ -34,7 +33,7 @@ - name: "Ensuring /opt/stack is present" file: name=/opt/stack state=directory owner=root group=root - 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" command: git checkout -f master chdir=/opt/stack/ironic - name: "Ironic - resetting master branch" @@ -237,22 +236,22 @@ stat: path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz register: test_core_os_kernel_present - 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 - name: "Test if CoreOS image is present" stat: path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz register: test_core_os_image_present - 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 - 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}}" - name: "Test if Ubuntu 14.04 server cloud amd64 is present" stat: path={{ deploy_image }} register: test_os_image_present - 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 - name: "Extract Ubuntu image" unarchive: src=/httpboot/ubuntu-14.04-server-cloudimg-amd64.tar.gz dest=/httpboot/ creates=/httpboot/trusty-server-cloudimg-amd64.img diff --git a/playbooks/roles/ironic-install/tasks/shade_source_install.yml b/playbooks/roles/ironic-install/tasks/shade_source_install.yml index 404ac938d..c76d1e442 100644 --- a/playbooks/roles/ironic-install/tasks/shade_source_install.yml +++ b/playbooks/roles/ironic-install/tasks/shade_source_install.yml @@ -14,7 +14,7 @@ # limitations under the License. --- - 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" command: git checkout -f master chdir=/opt/stack/shade - name: "Shade - Resetting local repository"