diff --git a/ansible/bifrost.yml b/ansible/bifrost.yml new file mode 100644 index 0000000000..bf29352b68 --- /dev/null +++ b/ansible/bifrost.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + roles: + - { role: bifrost, + tags: bifrost} diff --git a/ansible/roles/bifrost/tasks/bootstrap.yml b/ansible/roles/bifrost/tasks/bootstrap.yml new file mode 100644 index 0000000000..d4cb0fa79e --- /dev/null +++ b/ansible/roles/bifrost/tasks/bootstrap.yml @@ -0,0 +1,9 @@ +--- +- name: Bootstrap bifrost (this may take several minutes) + command: > + docker exec bifrost_deploy + bash -c '/bifrost/scripts/env-setup.sh && source /bifrost/env-vars + && source /opt/stack/ansible/hacking/env-setup && + ansible-playbook -vvvv -i /bifrost/playbooks/inventory/localhost + /bifrost/playbooks/install.yaml -e @/etc/bifrost/bifrost.yml + -e @/etc/bifrost/dib.yml -e skip_package_install=true' diff --git a/ansible/roles/bifrost/tasks/deploy.yml b/ansible/roles/bifrost/tasks/deploy.yml index d8717127f9..c1a47564f0 100644 --- a/ansible/roles/bifrost/tasks/deploy.yml +++ b/ansible/roles/bifrost/tasks/deploy.yml @@ -1,3 +1,5 @@ --- - include: config.yml +- include: start.yml +- include: bootstrap.yml diff --git a/ansible/roles/bifrost/tasks/start.yml b/ansible/roles/bifrost/tasks/start.yml new file mode 100644 index 0000000000..251ceb94cd --- /dev/null +++ b/ansible/roles/bifrost/tasks/start.yml @@ -0,0 +1,13 @@ +--- +- name: Starting bifrost deploy container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + image: "{{ bifrost_deploy_image_full }}" + name: "bifrost_deploy" + privileged: True + volumes: + - "{{ node_config_directory }}/bifrost/:/etc/bifrost:ro" + - "/etc/localtime:/etc/localtime:ro" + - "/dev:/dev" + diff --git a/doc/bifrost.rst b/doc/bifrost.rst index 0aa8c9f346..5e8f29c7cb 100644 --- a/doc/bifrost.rst +++ b/doc/bifrost.rst @@ -66,54 +66,9 @@ Production ---------- kolla-build bifrost-deploy -launch bifrost -============== -docker run -it --net=host -v /dev:/dev -d --privileged --name bifrost 192.168.1.51:5000/kollaglue/ubuntu-source-bifrost-deploy:3.0.0 - -bootstrap bifrost ansible -========================= - -TODO - -bootstrap bifrost manual -======================== - -docker exec -it bifrost bash - -generate ssh key ----------------- -ssh-keygen - -# source env variables -cd /bifrost -. env-vars -. /opt/stack/ansible/hacking/env-setup -cd playbooks/ - - -create /tmp/bootstrap_args --------------------------- - - skip_package_install: true - mysql_service_name: mysql - ansible_python_interpreter: /var/lib/kolla/venv/bin/python - network_interface: < add you network interface here > - # uncomment below if needed - # dhcp_pool_start: 192.168.2.200 - # dhcp_pool_end: 192.168.2.250 - # dhcp_lease_time: 12h - # dhcp_static_mask: 255.255.255.0 - -bootstap and start services ---------------------------- -ansible-playbook -vvvv -i /bifrost/playbooks/inventory/localhost /bifrost/playbooks/install.yaml -e @/tmp/bootstrap_args - - -Use bifrost -=========== - -check with "ironic node-list" should return with no nodes. +Prepare bifrost configs +======================= create servers.yml ------------------ @@ -121,7 +76,7 @@ create servers.yml the servers.yml will discribing your physical nodes and list ipmi credentials. see bifrost dynamic inventory examples for mor details. -e.g. /tmp/servers.yml +e.g. /etc/kolla/config/bifrost/servers.yml --- cloud1: @@ -147,29 +102,138 @@ cloud1: adjust as appropriate for your deployment +create bifrost.yml +------------------ +By default kolla mostly use bifrosts default playbook values. +Parameters passed to the bifrost install playbook can be overriden by +creating a bifrost.yml file in the kolla custom config director or in a +bifrost sub directory. +e.g. /etc/kolla/config/bifrost/bifrost.yml + + skip_package_install: true + mysql_service_name: mysql + ansible_python_interpreter: /var/lib/kolla/venv/bin/python + network_interface: < add you network interface here > + # uncomment below if needed + # dhcp_pool_start: 192.168.2.200 + # dhcp_pool_end: 192.168.2.250 + # dhcp_lease_time: 12h + # dhcp_static_mask: 255.255.255.0 + +Create Disk Image Builder Config +-------------------------------- +By default kolla mostly use bifrosts default playbook values when +building the baremetal os image. The baremetal os image can be customised +by creating a dib.yml file in the kolla custom config director or in a +bifrost sub directory. +e.g. /etc/kolla/config/bifrost/dib.yml + +dib_os_element: ubuntu + + +Deploy Bifrost +========================= + +manual +------ + +Start Bifrost Container +_______________________ +docker run -it --net=host -v /dev:/dev -d --privileged --name bifrost_deploy 192.168.1.51:5000/kollaglue/ubuntu-source-bifrost-deploy:3.0.0 + +copy configs +____________ + +docker exec -it bifrost_deploy mkdir /etc/bifrost +docker cp /etc/kolla/config/bifrost/servers.yml bifrost_deploy:/etc/bifrost/servers.yml +docker cp /etc/kolla/config/bifrost/bifrost.yml bifrost_deploy:/etc/bifrost/bifrost.yml +docker cp /etc/kolla/config/bifrost/dib.yml bifrost_deploy:/etc/bifrost/dib.yml + +bootstrap bifrost +_________________ + +docker exec -it bifrost_deploy bash + +generate ssh key +~~~~~~~~~~~~~~~~ + +ssh-keygen + +source env variables +~~~~~~~~~~~~~~~~~~~~ +cd /bifrost +. env-vars +. /opt/stack/ansible/hacking/env-setup +cd playbooks/ + + +bootstap and start services +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +ansible-playbook -vvvv -i /bifrost/playbooks/inventory/localhost /bifrost/playbooks/install.yaml -e @/etc/bifrost/bifrost.yml + +ansible +------- + +Development +___________ +tools/kolla-ansible bifrost-deploy -e bifrost_network_interface= + +Production +__________ +kolla-ansible deploy-kolla -e bifrost_network_interface= + +Check ironic is running +======================= + + +docker exec -it bifrost_deploy bash +cd /bifrost +. env-vars +running "ironic node-list" should return with no nodes. +e.g. + +(bifrost-deploy)[root@bifrost bifrost]# ironic node-list ++------+------+---------------+-------------+--------------------+-------------+ +| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance | ++------+------+---------------+-------------+--------------------+-------------+ ++------+------+---------------+-------------+--------------------+-------------+ Enroll Physical Nodes ---------------------- +===================== +ansible +------- +TODO + +manual +------ +docker exec -it bifrost_deploy bash +cd /bifrost +. env-vars export BIFROST_INVENTORY_SOURCE=/tmp/servers.yml ansible-playbook -vvvv -i inventory/bifrost_inventory.py enroll-dynamic.yaml -e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python" -e network_interface= Deploy Nodes ------------- -export BIFROST_INVENTORY_SOURCE=/tmp/servers.yml -ansible-playbook -vvvv -i inventory/bifrost_inventory.py deploy-dynamic.yaml -e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python" -e network_interface= +============ -at this point ironic should clean down your nodes and install the default -deabin image. +ansible +------- +TODO + +manual +------ +docker exec -it bifrost_deploy bash +cd /bifrost +. env-vars +export BIFROST_INVENTORY_SOURCE=/tmp/servers.yml +ansible-playbook -vvvv -i inventory/bifrost_inventory.py deploy-dynamic.yaml -e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python" -e network_interface= -e @/etc/bifrost/dib.yml + +At this point ironic should clean down your nodes and install the default os image. Advanced configuration ====================== -Custom images -------------- -TODO - Bring your own image -------------------- TODO diff --git a/releasenotes/notes/bifrost-f080de99005ad38e.yaml b/releasenotes/notes/bifrost-f080de99005ad38e.yaml index a308987d6f..889650492d 100644 --- a/releasenotes/notes/bifrost-f080de99005ad38e.yaml +++ b/releasenotes/notes/bifrost-f080de99005ad38e.yaml @@ -5,3 +5,8 @@ prelude: > Bifrost is a collection of ansible roles and playbooks to deploy a standalone instance of ironic. +features: + - A new deploy-bifrost command was added to + kolla-ansible. The deploy-bifrost command + will deploy and bootstrap a standalone + instance of ironic in a single container. diff --git a/tools/kolla-ansible b/tools/kolla-ansible index 5772e5f1a9..5e4380d791 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -165,6 +165,11 @@ EOF PLAYBOOK="${BASEDIR}/ansible/kolla-host.yml" EXTRA_OPTS="$EXTRA_OPTS -e action=bootstrap-servers" ;; +(bifrost-deploy) + ACTION="Deploying Bifrost" + PLAYBOOK="${BASEDIR}/ansible/bifrost.yml" + EXTRA_OPTS="$EXTRA_OPTS -e action=deploy" + ;; (deploy) ACTION="Deploying Playbooks" EXTRA_OPTS="$EXTRA_OPTS -e action=deploy"