Ansible
- Make fresh linux vm, must be 64 bit for Docker.
- If you run Windows, install virtualbox or VMware to host a virtual Linux machine. Manually load a downloaded Linux image inside virtualbox: http://askubuntu.com/questions/64915/how-do-i-install-ubuntu-on-a-virtualbox-client-from-an-iso-image
- Ubuntu http://releases.ubuntu.com/16.04/ around Debian.
- CentOS (free version of RedHat) https://www.centos.org/download/
- Inside virtualbox: forward 2222 to 22 to be able to use putty
- Ubuntu http://releases.ubuntu.com/16.04/ around Debian.
- If you run a Linux machine, use vagrant (from linux box / terminal)
- During installlation, tick openssh,.. If you forgot, afterwards do apt-get install openssh -server
- If you run Windows, install virtualbox or VMware to host a virtual Linux machine. Manually load a downloaded Linux image inside virtualbox: http://askubuntu.com/questions/64915/how-do-i-install-ubuntu-on-a-virtualbox-client-from-an-iso-image
- Standard python 2.7.12 is sufficient for Ansible
- Install Ansible (and if needed git)
sudo apt-get update sudo apt-get install ansible sudo apt-get install git
- Check whether Ansible installed, e.g. with check version: 2.0.0.2
ansible --version
Test
ansible all -i "localhost," -c local -m shell -a 'echo hello world'
- Make essential files to test Ansible
inventory (name can be different, but this is convention)
[local] localhost ansible_connection=local
playbook.yml (name can be different, but this is convention)
--- - name: Hello Ansible - quick start hosts: all tasks: - name: add current date to now.txt file shell: date >> now.txt
Run ansible-playbook
ansible-playbook playbook.yml --inventory inventory --user `whoami` # or in short format: ansible-playbook playbook.yml -i inventory -u `whoami`
Docker
Install docker to be able to run docker images. See also: https://github.com/openearth-stack/general/blob/master/testing.md
sudo apt-get install docker.io # add user, see git # docker run -it quay.io/travisci/travis-ruby /bin/bas
Become a member of the docker group
sudo usermod -aG docker $(whoami) # or alternatives to manually add your username to # docker:x:117:USERNAME # >> vigr # >> sudo nano /etc/group
Exit and log back to to make these changes effective. Create a shadow group
vigr -s
Run docker to install for instance a postgres container (https://hub.docker.com/_/postgres/)
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
You can see the container in
sudo ls /var/lib/docker/containers
YOu can run a second docker that talks to the first (using mysecretpassword)
docker run -it --rm --link some-postgres:postgres postgres psql -h postgres -U postgres