Update common-packer instructions 32/8232/7
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 5 Jan 2018 01:42:05 +0000 (20:42 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 5 Jan 2018 21:00:34 +0000 (16:00 -0500)
Instructions are a little different now that we are using the
Ansible provisioner.

Change-Id: I7296ed75af8f4962c427199a8ad755ec0fccc062
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
README.markdown

index 9512360..57ad0e5 100644 (file)
@@ -3,6 +3,34 @@
 The purpose of this repo is to store commonly used packer provisioning scripts
 and even instance templates that projects may use.
 
+## Installing lf-ansible
+
+common-packer requires an lf-ansible installation into the ci-management root.
+To install lf-ansible load it into the root of the ci-management repository as
+a submodule. Versioned git tags for lf-ansible is available allowing easy
+updates and rollback if necessary.
+
+```bash
+# Choose a lf-ansible version to install
+LF_ANSIBLE_VERSION=v0.1.0
+
+# Add the new submodule to ci-management's packer directory.
+# Note: Perform once per ci-management repo.
+git submodule add https://github.com/lfit/lf-ansible
+
+# Checkout the version of lf-ansible you wish to deploy
+cd lf-ansible
+git checkout $LF_ANSIBLE_VERSION
+
+# Commit lf-ansible version to the ci-managment repo
+cd ..
+git add lf-ansible
+git commit -sm "Install lf-ansible $LF_ANSIBLE_VERSION"
+
+# Push the patch to ci-management for review
+git review
+```
+
 ## Installing common-packer
 
 Deploy common-packer in the ci-management repository's packer directory as a
@@ -41,19 +69,26 @@ most cases this is 'provision/$SCRIPT' which is will now be
 To use any of the provided templates, the template should have a symlink into
 the calling project's templates directory. This is because our common-packer
 job scripts operate on the templates available in this directory. Any template,
-except the baseline, will also look for local customization out of the local
+except the 'builder', will also look for local customization out of the local
 repository's provisioning with both a directory as well as script exec.
 
+Distro specific vars are now provided in 'common-packer/vars/$DISTRO'.
+Path to them as normal and they will already contain the correct strings. For
+a new project make sure the base_image name is available in the cloud system.
+
 ## Example template design and run
 
-A common template that most of our projects use is 'basebuild' this template
-will do the following:
-
-1. Copy the provision/basebuild directory, which must exist in the parent
-   project, to /tmp/packer
-2. Execute the common baseline provisioning script
-3. Execute the common basebuild provisioning script
-4. Execute the local (provision/basebuild) provisioning script. This script may
-   execute any extra scripts that it needs out of the /tmp/packer directory
-   that have step one put on the system.
-5. Execute the common system reseal script
+In most cases the 'builder' template unmodified is all that the project should
+need to run their code builds. If a project has a custom packages that they
+must build into a custom builder type then design the new template with the
+following parameters.
+
+0. Execute the common-packer/provision/install-python.sh script
+1. Execute the common-packer/provision/baseline.yaml Ansible playbook
+2. Execute a local playbook
+3. Execute the system reseal Ansible role
+
+Steps 1-3 are actually all contained inside of the local playbook. Please refer
+to the docker template and provisioning script for an example of how it imports
+the existing baseline playbook into the local playbook to reduce duplication in
+code.