Provisioning and syncing Macs with Ansible

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
i just bought two i just bought two new macs and i have a problem i'm tempted to treat these things like pets maybe name them something cute instead of macintosh hd or do something crazy like migrate my data from my old macbook pro or a time machine backup but no these computers are cattle not pets some people think they should fall in love with their computers some people have precious backups some people have their computer die on them and it takes them a week before they're productive again but not you you don't treat your computer like a pet use it to do things it's a tool make it replaceable upgrades don't phase you anymore you don't have to wait like a schmuck while time machine sits around restoring your data you grab life by the horns you don't have time to wait for boring restore processes you automate well anyways that's the story i tell myself as i spend hours completely automating my mac setup process i use ansible for pete's sake if there's something worth doing once it's worth automating and doing a thousand times even if i only need to do it once and that's why i maintained this the mac dev playbook it automates my mac setup keeps my max configuration synchronized and makes sure that even if my mac and my entire backup system went belly up today i'd be able to get back into a productive state pretty quickly assuming there's an apple store nearby and how is that possible well this ansible-based playbook will take a brand new mac install all the software and command line tools i need configure many of them automatically and all i really need to do is log into icloud dropbox and any other cloud services i use i just finished updating my ansible mac automation to work on m1 max so i thought i'd show how i set up my air and mini in this quick video and you might also be asking if you can automatically set up your mac with ansible does the mac even have to be in front of you no in fact i recently made sure the whole playbook works great with any mac anywhere even if it's in a rack and a data center somewhere like at max stadium or the max you can rent in amazon web services before i get to it though i should take a short pause and emphasize that i do still have backups in fact i follow the 3-2-1 backup plan because losing my data would be devastating no really i couldn't bear to lose my grade school report all about computers the 3-2-1 back-up plan means i have three copies of all my data on at least two different types of storage media with at least one copy off-site my primary data copy is always on my main mac with a local time machine backup to my nas that mass is completely backed up to amazon glacier every night in fact it goes a little deeper because in addition to my two local copies and one cloud backup i also put all my critical data in projects inside dropbox which means it's backed up in four places anyways that means even if i had a huge disaster like red shirt jeff burning down my house or aliens taking over st louis i can rest easy knowing that my date is intact well i probably wouldn't rest easy since i just have the charred remains of a bed but you get what i mean back to the mac dev playbook though setup is really fast you basically install antib set your options and run the playbook after fixing a few bugs in the playbook while i set up my macbook air i unplugged my old macbook pro slid the mini into my rack and set it up from scratch first i ran through the manual steps creating a user account and signing into icloud then once i was in mac os i opened the app store and signed in since i'll need to be signed in for my mac apps to install automatically i made sure i could use the python 3 version shipped with mac os then i installed ansible with pip and made sure to install the xcode developer tools when i was asked i downloaded the mac dev playbook from github copied over my customized config file from my iphone with airdrop and installed the open source ansible content with this ansible galaxy command finally it's time to unleash the automation i ran the playbook using the k command line option which asks for my account password so the playbook can manage apps on my computer it installs all the apps i bought from the app store then it installs other apps with homebrew casks like chrome docker discord and slack and it installs everything i ever use on the command line too the first time i ran the playbook i actually ran into a few errors installing apps like this one because i was still getting used to the m1 architecture but it was short work fixing everything and thanks especially to github user xuji3 for a pr that fixed homebrew installation on m1 i also noticed that most apps take a few seconds or maybe a minute or two to install but for some reason xcode took like an hour and it was maxing out the cpu the whole time i'm not sure what it was doing but i noticed the xcode app was a whopping 30 gigabytes after that anyways the playbook also configures a bunch of things like most of the system settings i prefer like having a dark gray desktop background and the size of my dock and making my key repeat rate as fast as possible it even configures the order of apps in my docs since i like having the dock identical between my two macs and you know what's best about all this i built this thing to be item potent that means i can run the playbook again and it won't make any changes or break anything it just makes sure my mac is set up exactly how i like it in fact i run the playbook at least once a week on both my macs so they can stay perfectly in sync sadly not everything in this world is perfectly automatable applications like photoshop and illustrator can't be installed automatically at least not in any way i've found plus you still have to sign into everything and enter license keys for any paid apps that aren't installed through the app store so after all that fun watching my mac automatically build itself from scratch i had to sit there like a caveman and click buttons to get my precious paid apps installed and some apps like terminal and sublime text are easy to configure automatically or by saving a plist file but many apps don't expose their configuration to macos's default system so i have to scroll around and click on things like they did in the stone ages how old-fashioned but the nice thing about all this is i unboxed my mac mini plugged it in and within an hour it was up and running with an identical configuration in all my apps and data and i didn't even have to use time machine or sit around for hours watching migration assistant grab all the data from my old macbook pro and there are two other benefits first if you have more than one mac it's easy to keep the configuration in sync no not that in sync wrong graphic and second doing a 100 clean reinstall of your system every year or two instead of constantly upgrading and migrating everything keeps your mac running lean and mean 10 year old forgotten kernel extensions or a background app you installed for a smart mouse pad in 2000 won't cause you trouble next time you update mac os you can get the free and open source mac dev playbook on github and there's a link to it below and do you use linux well you could build pretty much the same thing it's easy to automate with ansible it could even do windows but you'll have to spend a lot more time with powershell scripts if you want to go that route if you want to learn more about ansible i'd strongly encourage you to check out my free ansible 101 series or buy my book ansible for devops until next time i'm jeff gearling i think there's an xkz it's uh heart rates let's let's check the heart rate here 113. see what i do for these videos [Music] kid running upstairs i put a joke in here but the joke is not there it was probably bad enough that the computer automatically deleted the joke for me but many apps don't expose their configuration to macos's defaults what was that
Info
Channel: Jeff Geerling
Views: 81,815
Rating: undefined out of 5
Keywords: mac, macos, macbook, macbook air, macbook pro, mac pro, macintosh, intel, m1, i9, i7, imac, mac mini, macminicolo, macstadium, aws, rack, infrastructure, automate, automation, setup, app, app store, homebrew, brew, ansible, ssh, headless, configure, configuration, plist, plistbuddy, dock, desktop, computer, fleet, jamf, apple, mas, command line, terminal, xcode, devops, automatic, easy
Id: 1VhPVu5EK5o
Channel Id: undefined
Length: 7min 43sec (463 seconds)
Published: Fri Jun 04 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.