Join Mac OSX to Active Directory with Ansible

Joining Mac OSX to Active Directory can be a time-consuming process, with lots of pointing and clicking in the GUI. Being a member of AD is helpful to enable single sign on for users in a mostly Windows domain. But, if you use Ansible, it can only take seconds to rejoin. This is especially helpful when the Mac drops off the domain and needs to be quickly re-added.

See the Ansible playbook in github here:

The most important line is this:

command: "dsconfigad -force -add {{ DOMAIN }} -computer {{ ansible_hostname }}\
 -username {{ username }} -password {{ password }} -ou {{ OUSTRING }}\
 -mobile enable -mobileconfirm disable -localhome enable -useuncpath enable\
 -groups 'Domain Admins' -shell /bin/bash "

It uses the ‘dsconfigad’ utility to remove and rejoin the Mac’s computer account to Active Directory.

Advertisements

Developer environment: Atom, Git, and Windows

How to set up your developer environment if you are on Windows, and need to edit code in Gitlab/Github

Atom is a beautiful, open-source text editor that will let you browse the tree of your code, jump easily between folders, and see color-coded text to make things easier to read. If you are on Windows, you may feel that your environment does not look as cool as on Mac, but by using Atom, you will take things up a notch in coolness.

What problem does this solve? If you need to edit Unix code on Windows, you must save it natively as Windows, with the correct permissions and ownership. If you try other crossover tools such as Ubuntu Bash on Windows, you may run into issues with corrupted files since you are trying to edit from both your local editor and from the Unix emulated command line.

  1. Install Atom and Git-Plus plugin
  2. Install Git-Bash for Windows – this provides all the unix tools you will need.
  3. Install Pageant for ssh agent – also see this site
    1. Create an ssh key (passphrase protected)
    2. Upload your ssh key to your Gitlab/Github profile settings
    3. Configure plink.exe to be your ssh tool
    4. Create a shortcut that opens Pageant with your ssh key

Then you will be able to use Git-Bash for Windows to edit files in git via command line. Or, if you prefer the graphical environment, you can use Atom with the integrated Git-Plus or similar tools.

Example usage for this is to commit and push your git changes via Atom, then have your webapp do a git pull to synchronize the changes.

Tips for using Atom:

Open your project with Atom: Right-click, Add Project Folder

Git commands: Ctrl-Shift-A + S =  git status
Ctrl-S to save changes to the file (takes a second)
Ctrl-A or Ctrl-Shift-A – add
Ctrl-Shift-X Commit
Control-Shift-H for git-plus menu including Add and Commit and Push