Process documentation
...
bundle exec cap staging maintenance:enable REASON="a test of maintenance mode" UNTIL="12pm Eastern Time"
- Deploy as usual / desired
- Do anything else needed on the server that required the downtime
bundle exec cap staging maintenance:disable
Building a new machine on AWS with Ansible
...
- place it in ~/.ssh
- chmod 0600.
- useful command if you're having problems with the key: $ openssl rsa -in chf_prod.pem -check
...
- $ ansible-vault edit group_vars/all
- Look for # Use these temporarily for new instances
- ensure your ssh key is listed under keys_to_add
...
- $ ansible-playbook -i hosts create_ec2.yml --private-key=/path/to/your/.ssh/key.pem --ask-vault-pass
- OR, if you're re-running scripts on an existing machine:
- $ ansible-playbook -i hosts my_playbook.yml --ask-vault-pass [-e hosts=ec2hosts]
- note that if there's a failure during postgres setup handlers may not run – watch out for this. if this happens it's potentially best to start over completely.
...
Set up Capistrano (first-time use)
...
- This keeps us from publishing server names, etc, in the cap config files which live in our public repo.
- don't change the Host designation without:
- Changing it in capistrano, e.g. deploy/staging.rb, to match
- Clearing it with everyone who might deploy (they'll have to change their ssh config as well.
- this will use your personal ssh key – the one that matches your public key on github, which is added to the deploy user by ansible scripts.
Git repositories for ansible - structure and use
Code lives at https://github.com/curationexperts/ansible-hydra
Wrapper with local configuration lives at https://bitbucket.org/ChemicalHeritageFoundation/ansible-inventory. Wrapper contains:
- our hosts file
- our group_vars files
- ansible-hydra as a git submodule
- an ansible.config which points to ansible-hydra for roles_path.
Aside: pull requests can be submitted via branches; there's really no need to fork this repo since we'll all be owners.
To use
- $ git clone clone git@bitbucket.org:ChemicalHeritageFoundation/ansible-inventory.git
- $ cd ansible-inventory
- $ git submodule update --init
Subsequently, when you pull ansible-inventory and the submodule has been updated, just run
...