diff --git a/README.rst b/README.rst index cb499ef54..85a9ffd53 100644 --- a/README.rst +++ b/README.rst @@ -79,7 +79,11 @@ The installation is split into two parts. The first part is a bash script which lays the basic groundwork of installing Ansible itself. -Edit ``./playbooks/inventory/group_vars/all`` to match your environment. +Edit ``./playbooks/inventory/group_vars/*`` to match your environment. The +localhost file is intended for steps executed upon the localhost, such as +installation, or image generation. The baremetal file is geared for steps +performed on baremetal nodes, such as enrollment, deployment, or any other +custom playbooks that a user may bolt on to this toolkit. - If MySQL is already installed, update mysql_password to match your local installation. - Change network_interface to match the interface that will need to service DHCP requests. @@ -339,7 +343,7 @@ virtual machines. An SSH key is generated for the ``ironic`` user when testing. The ironic conductor will use this key to connect to the host machine and run virsh commands. -#. Set ``testing`` to *true* in the ``playbooks/inventory/group_vars/all`` file. +#. Set ``testing`` to *true* in the ``playbooks/inventory/group_vars/localhost`` file. #. You may need to adjust the value for ``ssh_public_key_path``. #. Run the install step, as documented above, however adding "-e testing=true" to the Ansible command line. #. Execute the ``ansible-playbook -vvvv -i inventory/localhost test-bifrost-create-vm.yaml`` command to create a test virtual machine. diff --git a/playbooks/install.yaml b/playbooks/install.yaml index 9967af0da..fc3f5b94d 100644 --- a/playbooks/install.yaml +++ b/playbooks/install.yaml @@ -8,7 +8,6 @@ - { role: bifrost-prep-for-install, when: skip_install is not defined } - ironic-install - { role: bifrost-create-dib-image, dib_imagename: "{{ deploy_image }}", dib_imagetype: "qcow2", dib_os_element: "{{ dib_os_element|default('debian') }}", dib_elements: "vm serial-console simple-init {{ extra_dib_elements|default('') }}", dib_packages: "{{ dib_packages|default('') }}", when: create_image_via_dib == true and transform_boot_image == false } - - { role: bifrost-create-bootable-image, when: create_image_via_dib == false and transform_boot_image == true } environment: http_proxy: "{{ lookup('env','http_proxy') }}" https_proxy: "{{ lookup('env','https_proxy') }}" diff --git a/playbooks/inventory/group_vars/all b/playbooks/inventory/group_vars/all deleted file mode 100644 index 02bee7d3d..000000000 --- a/playbooks/inventory/group_vars/all +++ /dev/null @@ -1,45 +0,0 @@ ---- -ironic_url: "http://localhost:6385/" -network_interface: "virbr0" -# ironic_db_password ironic user password for rabbit -ironic_db_password: aSecretPassword473z -# mysql_password: mysql root user password -mysql_password: -# If testing is true, then the environment is setup for using libvirt -# virtual machines for the hardware instead of real hardware. -# testing: true -# -# Normally this user should be root, however if cirros is used, -# a user may wish to define a specific user for testing VM -# connectivity during a test sequence -testing_user: root -http_boot_folder: /httpboot -nginx_port: 8080 -ssh_public_key_path: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub" -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" -# When using disk image builder based image generation, which is the -# default at this time, the deploy_image_filename must end with .qcow2 -# due to the image creation process. -deploy_image_filename: "deployment_image.qcow2" -deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" -# Setting to utilize diskimage-builder to create a bootable image. -create_image_via_dib: true -# Add any extra elements you wish to have in the disk image -extra_dib_elements: "" -# Transform boot image is intended for use with the Ubuntu trusty image. It makes the image bootable by installing Grub. -# Setting to prepend a partition image with a boot sector and partition table. -transform_boot_image: false -node_default_network_interface: eth0 -# ipv4_subnet_mask is intended for the static ipv4 address assignments. -ipv4_subnet_mask: 255.255.255.0 -ipv4_gateway: 192.168.1.1 -ipv4_nameserver: 8.8.8.8 -network_mtu: 1500 -dhcp_pool_start: 192.168.1.200 -dhcp_pool_end: 192.168.1.250 -# ipmi_bridging: Default undefined. Valid values: "no", "single", and "dual" -# See http://docs.openstack.org/developer/ironic/_modules/ironic/drivers/modules/ipmitool.html -#ipmi_bridging: no diff --git a/playbooks/inventory/group_vars/baremetal b/playbooks/inventory/group_vars/baremetal new file mode 100644 index 000000000..8716ba58f --- /dev/null +++ b/playbooks/inventory/group_vars/baremetal @@ -0,0 +1,44 @@ +--- +# The Ironic API URL for Bifrost Operations. Defaults to localhost. +#ironic_url: "http://localhost:6385/" + +# The network interface that Bifrost will be operating on. Defaults +# to virbr0 in roles, can be overridden here. +#network_interface: "virbr0" + +# The path to the SSH key to be utilized for testing and burn-in +# to configuration drives. When set, it should be set in both baremetal +# and localhost groups, however this is only an override to the default. +# ssh_public_key_path: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub" + +# Normally this user should be root, however if cirros is used, +# a user may wish to define a specific user for testing VM +# connectivity during a test sequence +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 + +#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" + +# The http_boot_folder defines the root folder for the webserver. +# If this setting is changed, it must be applied to both the baremetal +# and localhost groups. Presently the role defaults are set to the value +# below. +#http_boot_folder: /httpboot + +# The settings for the name of the image to be deployed along with the +# on disk location are below. If changed, these settings must be applied +# to both the baremetal and localhost groups. If the file is already on +# disk, then the image generation will not take place, otherwise an image +# will be generated using diskimage-builder. +#deploy_image_filename: "deployment_image.qcow2" +#deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" diff --git a/playbooks/inventory/group_vars/localhost b/playbooks/inventory/group_vars/localhost new file mode 100644 index 000000000..b4fa9b157 --- /dev/null +++ b/playbooks/inventory/group_vars/localhost @@ -0,0 +1,56 @@ +--- +# The Ironic API URL for Bifrost Operations. Defaults to localhost. +#ironic_url: "http://localhost:6385/" + +# The network interface that Bifrost will be operating on. Defaults +# to virbr0 in roles, can be overridden here. +#network_interface: "virbr0" + + +# ironic_db_password ironic user password for rabbit +ironic_db_password: aSecretPassword473z +# mysql_password: mysql root user password +mysql_password: + +# The path to the SSH key to be utilized for testing and burn-in +# to configuration drives. When set, it should be set in both baremetal +# and localhost groups, however this is only an override to the default. +# ssh_public_key_path: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub" + +# If testing is true, then the environment is setup for using libvirt +# virtual machines for the hardware instead of real hardware. +# testing: true + +# 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 + +#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" + +# The http_boot_folder defines the root folder for the webserver. +# If this setting is changed, it must be applied to both the baremetal +# and localhost groups. Presently the role defaults are set to the value +# below. +#http_boot_folder: /httpboot + +# The settings for the name of the image to be deployed along with the +# on disk location are below. If changed, these settings must be applied +# to both the baremetal and localhost groups. If the file is already on +# disk, then the image generation will not take place, otherwise an image +# will be generated using diskimage-builder. +#deploy_image_filename: "deployment_image.qcow2" +#deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" + +# Setting to utilize diskimage-builder to create a bootable image. +create_image_via_dib: true + +# Transform boot image is intended for use with the Ubuntu trusty image. It makes the image bootable by installing Grub. +# Setting to prepend a partition image with a boot sector and partition table. +transform_boot_image: false diff --git a/playbooks/inventory/localhost b/playbooks/inventory/localhost index 2fbb50c4a..f93090650 100644 --- a/playbooks/inventory/localhost +++ b/playbooks/inventory/localhost @@ -1 +1,2 @@ +[localhost] localhost diff --git a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml index 435f2a763..5c7625130 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml @@ -4,3 +4,17 @@ # such that cirros will receive basic network configuration when # performing basic testing. write_interfaces_file: false +http_boot_folder: /httpboot +# Default location to the ssh public key for the user operating Bifrost. +ssh_public_key_path: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub" + +# Default interface name +# TODO(TheJulia): Remove this default. +node_default_network_interface: eth0 + +# Basic networking defaults +# TODO(TheJulia): Require these to be supplied some other way. +ipv4_subnet_mask: 255.255.255.0 +ipv4_gateway: 192.168.1.1 +ipv4_nameserver: 8.8.8.8 +network_mtu: 1500 diff --git a/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml b/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml index 71704b89f..8238323ff 100644 --- a/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-deploy-nodes-dynamic/defaults/main.yml @@ -2,3 +2,7 @@ # defaults file for bifrost-deploy-nodes-dynamic ironic_url: "http://localhost:6385/" nginx_port: 8080 +network_interface: "virbr0" +http_boot_folder: "/httpboot" +deploy_image_filename: "deployment_image.qcow2" +deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}" diff --git a/playbooks/roles/bifrost-openstack-ci-prep/defaults/main.yml b/playbooks/roles/bifrost-openstack-ci-prep/defaults/main.yml index 5c7ca92ce..9bcb36e04 100644 --- a/playbooks/roles/bifrost-openstack-ci-prep/defaults/main.yml +++ b/playbooks/roles/bifrost-openstack-ci-prep/defaults/main.yml @@ -1,2 +1,3 @@ --- -# defaults file for bifrost-openstack-ci-prep +# Default location to the ssh public key for the user operating Bifrost. +ssh_public_key_path: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub" diff --git a/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml b/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml index 44445bba9..b3799be85 100644 --- a/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml +++ b/playbooks/roles/ironic-enroll-dynamic/defaults/main.yml @@ -1,2 +1,6 @@ --- ironic_url: "http://localhost:6385/" +nginx_port: 8080 +network_interface: "virbr0" +ipa_kernel_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/ipa.vmlinuz" +ipa_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/ipa.initramfs" diff --git a/playbooks/roles/ironic-install/README.md b/playbooks/roles/ironic-install/README.md index c1c68508c..fc5d93225 100644 --- a/playbooks/roles/ironic-install/README.md +++ b/playbooks/roles/ironic-install/README.md @@ -41,11 +41,24 @@ however testing may require master branch or custom patches. ironicclient_source_install: false shade_source_install: false +Bifrost requires access to the network where nodes are located, in order to +provision the nodes. By default, this setting is set to a value for local +VM based testing, however if and when your ready to deploy to a physical +environment, you will need to set the network_interface variable to the +attached network. + +network_interface: "virbr0" + By default this role installs dnsmasq to act as a DHCP server for provisioning hosts. In the event this is not required, set the following configuration: include_dhcp_server: false +If you chose to utilize the dhcp server, You may wish to set default ranges: + +dhcp_pool_start: 192.168.1.200 +dhcp_pool_end: 192.168.1.250 + In case your HW needs a kernel option to boot, set the following variable: extra_kernel_options: Default undefined. @@ -81,6 +94,7 @@ Example Playbook - role: ironic-install cleaning: false testing: true + network_interface: "virbr0" License ------- diff --git a/playbooks/roles/ironic-install/defaults/main.yml b/playbooks/roles/ironic-install/defaults/main.yml index 354968ca1..b424a1a01 100644 --- a/playbooks/roles/ironic-install/defaults/main.yml +++ b/playbooks/roles/ironic-install/defaults/main.yml @@ -14,11 +14,11 @@ transform_boot_image: false # virtual machines for the hardware instead of real hardware. testing: false ci_testing: false -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_kernel: "{{http_boot_folder}}/ipa.vmlinuz" +ipa_ramdisk: "{{http_boot_folder}}/ipa.initramfs" +ipa_kernel_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_port}}/ipa.vmlinuz" ipa_kernel_upstream_url: http://tarballs.openstack.org/ironic-python-agent/coreos/files/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_ramdisk_url: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{nginx_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}}" @@ -42,3 +42,8 @@ ironicclient_git_folder: /opt/stack/python-ironicclient shade_git_folder: /opt/stack/shade # Comma separated list, in the format of a string, of drivers that are enabled. enabled_drivers: "agent_ipmitool,pxe_amt,agent_ilo,agent_ucs" +# DHCP pool for requests +dhcp_pool_start: 192.168.1.200 +dhcp_pool_end: 192.168.1.250 +# Default network interface that Bifrost will be attached to. +network_interface: "virbr0" diff --git a/playbooks/test-bifrost-dynamic.yaml b/playbooks/test-bifrost-dynamic.yaml index e3d4c0a8d..3cf32dd13 100644 --- a/playbooks/test-bifrost-dynamic.yaml +++ b/playbooks/test-bifrost-dynamic.yaml @@ -51,7 +51,6 @@ cleaning: false testing: true - { role: bifrost-create-dib-image, dib_imagetype: "qcow2", dib_imagename: "{{deploy_image}}", dib_os_element: "{{ dib_os_element|default('debian') }}", dib_elements: "vm serial-console simple-init {{ extra_dib_elements|default('') }}", dib_packages: "{{ dib_packages|default('') }}", when: create_image_via_dib == true and transform_boot_image == false } - - { role: bifrost-create-bootable-image, when: create_image_via_dib == false and transform_boot_image == true } environment: http_proxy: "{{ lookup('env','http_proxy') }}" https_proxy: "{{ lookup('env','https_proxy') }}"