Skip to content

Instantly share code, notes, and snippets.

@ryanmoon
Last active August 17, 2017 18:35
Show Gist options
  • Save ryanmoon/e5c96192aaadf832e59a6fed65807f4e to your computer and use it in GitHub Desktop.
Save ryanmoon/e5c96192aaadf832e59a6fed65807f4e to your computer and use it in GitHub Desktop.
Nested workflow example for imagr, with a default autorun workflow, named WORKFLOW.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Globals -->
<key>autorun</key>
<string>WORKFLOW</string>
<key>autorun_time</key>
<integer>300</integer>
<key>default_workflow</key>
<string>WORKFLOW</string>
<key>background_image</key>
<string>http://munki/munki_repo/imagr/img/imagr_background.jpg</string>
<!-- End of Globals -->
<!-- Workflows -->
<key>workflows</key>
<array>
<!-- Start of WORKFLOW -->
<dict>
<key>name</key>
<string>WORKFLOW</string>
<key>description</key>
<string>Requires the API, machine image flag set to true.</string>
<key>restart_action</key>
<string>restart</string>
<key>bless_target</key>
<true/>
<key>components</key>
<array>
<dict>
<key>first_boot</key>
<false/>
<key>type</key>
<string>script</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/scripts/imagr/first_run_check.sh</string>
</dict>
<dict>
<key>script</key>
<string>#!/bin/bash
workflow=$(/usr/bin/curl http://api/{{serial_number}} | awk -F '"' '/workflow/ {print $4}')
if [[ "$workflow" == "14" ]]; then
printf "ImagrIncludedWorkflow: 14"
elif [[ "$workflow" == "13" ]]; then
printf "ImagrIncludedWorkflow: 13"
elif [[ "$workflow" == "12" ]]; then
printf "ImagrIncludedWorkflow: 12"
elif [[ "$workflow" == "11" ]]; then
printf "ImagrIncludedWorkflow: 11"
elif [[ "$workflow" == "10" ]]; then
printf "ImagrIncludedWorkflow: 10"
elif [[ "$workflow" == "9" ]]; then
printf "ImagrIncludedWorkflow: 9"
fi</string>
<key>type</key>
<string>included_workflow</string>
</dict>
</array>
</dict>
<!-- End of WORKFLOW -->
<!-- Start of SCRIPTS-PKGS -->
<dict>
<key>name</key>
<string>SCRIPTS-PKGS</string>
<key>hidden</key>
<true/>
<key>description</key>
<string>All of the included items for all imagr runs.</string>
<key>components</key>
<array>
<dict>
<key>first_boot</key>
<false/>
<key>type</key>
<string>script</string>
<key>content</key>
<string>#!/bin/bash
/usr/bin/touch "{{target_volume}}/var/db/.AppleSetupDone"</string>
</dict>
<dict>
<key>first_boot</key>
<true/>
<key>type</key>
<string>script</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/scripts/imagr/imagr_first_boot.sh</string>
</dict>
<dict>
<key>first_boot</key>
<true/>
<key>type</key>
<string>package</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/pkgs/macos/chef-12.17.44-1.pkg</string>
</dict>
<dict>
<key>first_boot</key>
<true/>
<key>type</key>
<string>package</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/pkgs/macos/validation_pem.pkg</string>
</dict>
<dict>
<key>first_boot</key>
<true/>
<key>type</key>
<string>script</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/scripts/imagr/002-first_chef_run.sh</string>
</dict>
<dict>
<key>first_boot</key>
<true/>
<key>type</key>
<string>script</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/scripts/imagr/003-first_munki_run.sh</string>
</dict>
<dict>
<key>first_boot</key>
<true/>
<key>type</key>
<string>script</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/scripts/imagr/004-second_chef_run.sh</string>
</dict>
<dict>
<key>first_boot</key>
<true/>
<key>type</key>
<string>script</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/scripts/imagr/005-outset_last_munki_run.sh</string>
</dict>
<dict>
<key>first_boot</key>
<true/>
<key>type</key>
<string>script</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/scripts/imagr/network-interface-disabler.sh</string>
</dict>
</array>
</dict>
<!-- End of SCRIPTS-PKG -->
<!-- Start of 14 -->
<dict>
<key>name</key>
<string>14</string>
<key>description</key>
<string>HighestSierra</string>
<key>hidden</key>
<true/>
<key>bless_target</key>
<true/>
<key>restart_action</key>
<string>restart</string>
<key>components</key>
<array>
<dict>
<key>first_boot</key>
<false/>
<key>type</key>
<string>image</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/images/10.14.0.hfs.dmg</string>
</dict>
<dict>
<key>name</key>
<string>SCRIPTS-PKGS</string>
<key>type</key>
<string>included_workflow</string>
</dict>
</array>
</dict>
<!-- End of 14 -->
<!-- Start of 13 -->
<dict>
<key>name</key>
<string>13</string>
<key>description</key>
<string>HighSierra</string>
<key>hidden</key>
<true/>
<key>bless_target</key>
<true/>
<key>restart_action</key>
<string>restart</string>
<key>components</key>
<array>
<dict>
<key>first_boot</key>
<false/>
<key>type</key>
<string>image</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/images/10.13.0.hfs.dmg</string>
</dict>
<dict>
<key>name</key>
<string>SCRIPTS-PKGS</string>
<key>type</key>
<string>included_workflow</string>
</dict>
</array>
</dict>
<!-- End of 13 -->
<!-- Start of 12 -->
<dict>
<key>name</key>
<string>12</string>
<key>description</key>
<string>Sierra</string>
<key>hidden</key>
<true/>
<key>bless_target</key>
<true/>
<key>restart_action</key>
<string>restart</string>
<key>components</key>
<array>
<dict>
<key>first_boot</key>
<false/>
<key>type</key>
<string>image</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/images/10.12.6-16G29.hfs.dmg</string>
</dict>
<dict>
<key>name</key>
<string>SCRIPTS-PKGS</string>
<key>type</key>
<string>included_workflow</string>
</dict>
</array>
</dict>
<!-- End of 12 -->
<!-- Start of 11 -->
<dict>
<key>name</key>
<string>11</string>
<key>description</key>
<string>El Capitan</string>
<key>hidden</key>
<true/>
<key>bless_target</key>
<true/>
<key>restart_action</key>
<string>restart</string>
<key>components</key>
<array>
<dict>
<key>first_boot</key>
<false/>
<key>type</key>
<string>image</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/images/10.11.6-15G31.hfs.dmg</string>
</dict>
<dict>
<key>name</key>
<string>SCRIPTS-PKGS</string>
<key>type</key>
<string>included_workflow</string>
</dict>
</array>
</dict>
<!-- End of 11 -->
<!-- Start of 10 -->
<dict>
<key>name</key>
<string>10</string>
<key>description</key>
<string>Yosemite</string>
<key>hidden</key>
<true/>
<key>bless_target</key>
<true/>
<key>restart_action</key>
<string>restart</string>
<key>components</key>
<array>
<dict>
<key>first_boot</key>
<false/>
<key>type</key>
<string>image</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/images/10.10.5-14F27.hfs.dmg</string>
</dict>
<dict>
<key>name</key>
<string>SCRIPTS-PKGS</string>
<key>type</key>
<string>included_workflow</string>
</dict>
</array>
</dict>
<!-- End of 10 -->
<!-- Start of 9 -->
<dict>
<key>name</key>
<string>9</string>
<key>description</key>
<string>Mavericks</string>
<key>hidden</key>
<true/>
<key>bless_target</key>
<true/>
<key>restart_action</key>
<string>restart</string>
<key>components</key>
<array>
<dict>
<key>first_boot</key>
<false/>
<key>type</key>
<string>image</string>
<key>url</key>
<string>http://munki/munki_repo/imagr/images/10.9.5-13F34.hfs.dmg</string>
</dict>
<dict>
<key>name</key>
<string>SCRIPTS-PKGS</string>
<key>type</key>
<string>included_workflow</string>
</dict>
</array>
</dict>
<!-- End of 9 -->
</array>
<!-- END OF WORKFLOWS -->
</dict>
</plist>
@ryanmoon
Copy link
Author

If you use imagr's validateplist tool, all comments are removed. So take note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment