Integrate Chef Server Data Using Seiso
December 15, 2014
In Manage Your Service Data with GitHub, Jenkins & Seiso we learned how to manage service data using version control, and how to pull it into Seiso where it can be integrated with data from other sources. We noted that while it's possible to manage machine data in source control, it's not the only option. Especially with cloud-based infrastructure, we generally want to source machine data in a fashion that's more dynamic than what version control would typically support.
In this guide we import dynamic machine data from Chef server into Seiso, integrating it with the more static service data that we manage in version control. This integrated view allows you to support a range of deployment and operational use cases. We'll do this with a Jenkins job that performs the sync as a batch operation on a regular period.
While you can import machine data into Seiso just fine without already having the service data in place, there's no integration without the service data. So consider starting off with the Manage Your Service Data with GitHub, Jenkins & Seiso guide.
Before setting up the Jenkins job, it's a good idea to do a manual import first, just to get the configuration right. Follow the instructions for using seiso-import-chef.
We just set up a job to run the following script on a timer. The script basically does what we just did in step 2 above. Modify it as necessary for your own use.
#!/bin/bash -l set -e source /etc/profile.d/rvm.sh rvm use 1.9.3-p547 echo "Installing importer" gem install --no-rdoc --no-ri seiso-import_chef echo "Configuring importer" mkdir -p $HOME/.seiso-importers cat > $HOME/.seiso-importers/seiso.yml <<-EOF host: seiso.example.com port: 443 use_ssl: true ignore_cert: true username: seiso-batch password: $api_password EOF cat > $HOME/.seiso-importers/chef.yml <<-EOF base_uri: http://chef.example.com:4000 client_name: jenkins signing_key: jenkins.pem EOF seiso-import-chef set +e
In Seiso, nodes have a
machine property, so to link your nodes and machines you'll need to (re)import your nodes. After your jobs have imported your machines, you can import your nodes easily enough with something like this
$ cd /path/to/repos $ seiso-import-master */nodes/*.json
If all goes well, you can go into Seiso and see your Seiso nodes linked up to your Chef-provided machines.