A getting started guide.
Given that you have set up a new instance and the instance is up and running. Python 2 should be already installed on OS X.
If you want to try this out quicky I recommend using Digital Ocean. You can use my referral link to get you some starting money $10 by registering via https://www.digitalocean.com/?refcode=e8eaca937c55.
- ansible
brew install ansible - ssh-copy-id
brew install ssh-copy-id
Do the following on your local machine.
The instance's IP address.
export HOST=your.host.ip.hereLet's call the provision user deployer. Feel free to change.
export PROVUSER=deployerAdd user with home dir and bash as shell.
ssh root@$HOST useradd -m -s /bin/bash $PROVUSERGive her a password.
ssh root@$HOST passwd $PROVUSERDefaults are expected. Pick a passphrase, don't leave it empty.
ssh-keygen -t rsaStart agent.
ssh-agent bashAdd your identity.
ssh-addOn your local machine.
ssh-copy-id -i ~/.ssh/id_rsa.pub $PROVUSER@$HOSTEnsure that keys match. The command returns 0 on success.
diff -u <(ssh $PROVUSER@$HOST cat /home/$PROVUSER/.ssh/authorized_keys) ~/.ssh/id_rsa.pub > /dev/null; echo $?If you get a non-zero value; ssh to host and and compare host's ~/.ssh/authorized_keys with your public key ~/.ssh/id_rsa.pub on your local machine. (Or remove the redirection to /dev/null to see the diff.)
Do the following steps in your project dir. You could place playbooks and other related files to a folder called $PROJECT_DIR/provisioning for instance.
This is where your hosts are defined. For example cat $PROJECT_DIR/provisioning/hosts shows:
[ec2]
1.1.1.1
1.1.1.2
[rds]
1.1.2.1
ansible all -u $PROVUSER -m ping -i hostsIf you got a green light you're good to go. Otherwise run the command again with -vvvv flag and check what's up.
Any additions are welcome. Just be short and descriptive. Keep it simple.