add deploy-servers command

- This change extends kolla-ansible
  with a deploy-server command to enroll and deploy
  physical servers with bifrost.

Change-Id: Iaa9f34b00e676569f6e3df679b7454b1ec0b8e34
Implements: blueprint bifrost-support
This commit is contained in:
Sean Mooney 2016-08-01 21:57:48 +00:00
parent 538dbac24a
commit 64c40e20a5
4 changed files with 66 additions and 35 deletions

View File

@ -0,0 +1,21 @@
---
- name: Enrolling physical servers with ironic
command: >
docker exec bifrost_deploy
bash -c 'source /bifrost/env-vars
&& source /opt/stack/ansible/hacking/env-setup &&
export BIFROST_INVENTORY_SOURCE=/etc/bifrost/servers.yml &&
ansible-playbook -vvvv -i /bifrost/playbooks/inventory/bifrost_inventory.py
/bifrost/playbooks/enroll-dynamic.yaml -e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python"
-e @/etc/bifrost/bifrost.yml'
- name: deploy physical servers with ironic
command: >
docker exec bifrost_deploy
bash -c 'source /bifrost/env-vars
&& source /opt/stack/ansible/hacking/env-setup &&
export BIFROST_INVENTORY_SOURCE=/etc/bifrost/servers.yml &&
ansible-playbook -vvvv -i /bifrost/playbooks/inventory/bifrost_inventory.py
/bifrost/playbooks/deploy-dynamic.yaml -e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python"
-e @/etc/bifrost/bifrost.yml'

View File

@ -18,7 +18,7 @@ fix hosts file
-------------- --------------
Docker bind mounts ``/etc/hosts`` into the container from a volume. Docker bind mounts ``/etc/hosts`` into the container from a volume.
This prevents atomic renames which will prevent ansible from fixing This prevents atomic renames which will prevent ansible from fixing
the ``/etc/host`` file automatically. the ``/etc/hosts`` file automatically.
to enable bifrost to be bootstrapped correctly to enable bifrost to be bootstrapped correctly
add the deployment hosts hostname to 127.0.0.1 line add the deployment hosts hostname to 127.0.0.1 line
@ -110,7 +110,6 @@ creating a bifrost.yml file in the kolla custom config director or in a
bifrost sub directory. bifrost sub directory.
e.g. /etc/kolla/config/bifrost/bifrost.yml e.g. /etc/kolla/config/bifrost/bifrost.yml
skip_package_install: true
mysql_service_name: mysql mysql_service_name: mysql
ansible_python_interpreter: /var/lib/kolla/venv/bin/python ansible_python_interpreter: /var/lib/kolla/venv/bin/python
network_interface: < add you network interface here > network_interface: < add you network interface here >
@ -134,6 +133,17 @@ dib_os_element: ubuntu
Deploy Bifrost Deploy Bifrost
========================= =========================
ansible
-------
Development
___________
tools/kolla-ansible deploy-bifrost
Production
__________
kolla-ansible deploy-bifrost
manual manual
------ ------
@ -167,21 +177,10 @@ cd /bifrost
cd playbooks/ cd playbooks/
bootstap and start services bootstrap and start services
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
ansible-playbook -vvvv -i /bifrost/playbooks/inventory/localhost /bifrost/playbooks/install.yaml -e @/etc/bifrost/bifrost.yml 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=<pxe network interface>
Production
__________
kolla-ansible deploy-kolla -e bifrost_network_interface=<pxe network interface>
Check ironic is running Check ironic is running
======================= =======================
@ -199,34 +198,33 @@ e.g.
+------+------+---------------+-------------+--------------------+-------------+ +------+------+---------------+-------------+--------------------+-------------+
Enroll Physical Nodes Enroll and Deploy Physical Nodes
===================== ================================
ansible ansible
------- -------
TODO
Development
___________
tools/kolla-ansible deploy-servers
Production
__________
kolla-ansible deploy-servers
manual manual
------ ------
docker exec -it bifrost_deploy bash docker exec -it bifrost_deploy bash
cd /bifrost cd /bifrost
. env-vars . env-vars
export BIFROST_INVENTORY_SOURCE=/tmp/servers.yml export BIFROST_INVENTORY_SOURCE=/etc/bifrost/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=<provisioning interface> ansible-playbook -vvvv -i inventory/bifrost_inventory.py enroll-dynamic.yaml -e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python" -e network_interface=<provisioning interface>
Deploy Nodes
============
ansible
-------
TODO
manual
------
docker exec -it bifrost_deploy bash docker exec -it bifrost_deploy bash
cd /bifrost cd /bifrost
. env-vars . env-vars
export BIFROST_INVENTORY_SOURCE=/tmp/servers.yml export BIFROST_INVENTORY_SOURCE=/etc/bifrost/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=<prvisioning interface> -e @/etc/bifrost/dib.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=<prvisioning interface> -e @/etc/bifrost/dib.yml
At this point ironic should clean down your nodes and install the default os image. At this point ironic should clean down your nodes and install the default os image.

View File

@ -10,3 +10,8 @@ features:
kolla-ansible. The deploy-bifrost command kolla-ansible. The deploy-bifrost command
will deploy and bootstrap a standalone will deploy and bootstrap a standalone
instance of ironic in a single container. instance of ironic in a single container.
- A new deploy-server command was added to
kolla-ansible. The deploy-server command
uses a locally deployed instance of bifrost
to enrole servers with ironic and provision
their os.

View File

@ -42,9 +42,11 @@ Commands:
prechecks Do pre-deployment checks for hosts prechecks Do pre-deployment checks for hosts
mariadb_recovery Recover a completely stopped mariadb cluster mariadb_recovery Recover a completely stopped mariadb cluster
bootstrap-servers bootstrap servers with kolla deploy dependencies bootstrap-servers bootstrap servers with kolla deploy dependencies
deploy Deploy and start all kolla containers
destroy Destroy Kolla containers, volumes and host configuration destroy Destroy Kolla containers, volumes and host configuration
('-e destroy_include_images=yes' to also destroy Kolla images) ('-e destroy_include_images=yes' to also destroy Kolla images)
deploy Deploy and start all kolla containers
deploy-bifrost Deploy and start bifrost container
deploy-servers Enroll and deploy servers with bifrost
post-deploy Do post deploy on deploy node post-deploy Do post deploy on deploy node
pull Pull all images for containers (only pulls, no running container changes) pull Pull all images for containers (only pulls, no running container changes)
reconfigure Reconfigure OpenStack service reconfigure Reconfigure OpenStack service
@ -146,19 +148,24 @@ case "$1" in
PLAYBOOK="${BASEDIR}/ansible/destroy.yml" PLAYBOOK="${BASEDIR}/ansible/destroy.yml"
;; ;;
(bootstrap-servers) (bootstrap-servers)
ACTION="Deploying Playbooks" ACTION="Bootstraping servers"
PLAYBOOK="${BASEDIR}/ansible/kolla-host.yml" PLAYBOOK="${BASEDIR}/ansible/kolla-host.yml"
EXTRA_OPTS="$EXTRA_OPTS -e action=bootstrap-servers" 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) (deploy)
ACTION="Deploying Playbooks" ACTION="Deploying Playbooks"
EXTRA_OPTS="$EXTRA_OPTS -e action=deploy" EXTRA_OPTS="$EXTRA_OPTS -e action=deploy"
;; ;;
(deploy-bifrost)
ACTION="Deploying Bifrost"
PLAYBOOK="${BASEDIR}/ansible/bifrost.yml"
EXTRA_OPTS="$EXTRA_OPTS -e action=deploy"
;;
(deploy-servers)
ACTION="Deploying servers with bifrost"
PLAYBOOK="${BASEDIR}/ansible/bifrost.yml"
EXTRA_OPTS="$EXTRA_OPTS -e action=deploy-servers"
;;
(post-deploy) (post-deploy)
ACTION="Post-Deploying Playbooks" ACTION="Post-Deploying Playbooks"
PLAYBOOK="${BASEDIR}/ansible/post-deploy.yml" PLAYBOOK="${BASEDIR}/ansible/post-deploy.yml"