Skip to content

Instantly share code, notes, and snippets.

@mmaia
Last active March 18, 2018 10:13
Show Gist options
  • Save mmaia/7b0428b50ad2fbc3b4bf23818869e5b0 to your computer and use it in GitHub Desktop.
Save mmaia/7b0428b50ad2fbc3b4bf23818869e5b0 to your computer and use it in GitHub Desktop.
ansible-playbook to configure local workstation when Ubuntu linux is installed(tested with 16.04 LTS desktop). Run with: `ansible-playbook local-config.yml --extra-vars "ansible_sudo_pass=$SUDO_PWD`"
---
- name: configure local machine sudo
hosts: localhost
sudo: yes
tasks:
- name: ensure up to date O.S
command: apt -y update
- name: install base packages
apt: pkg={{item}} state=present update_cache=yes cache_valid_time=604800
with_items:
- git
- vim
- ruby-dev
- gimp
- wireshark
- curl
- build-essential
- libssl-dev
- terminator
- shutter
- name: install ruby dependencies
gem: name={{item}} state=present
with_items:
- watir
- name: Ensure group docker
group:
name: docker
state: present
system: yes
- name: Ensure user docker
user:
name: docker
groups: docker,sudo
shell: 'usermod -aG docker $USER'
- name: Ensure docker is installed
apt:
name: docker.io
state: present
- name: Check Docker service
service: name=docker state=started enabled=yes
- name: check installed docker compose version
shell: "/usr/local/bin/docker-compose --version | awk -F'[ ,]' '{ print $3; }' | grep 1.19.0"
register: docker_compose_version_installed_result
failed_when: false
changed_when: false
- name: store installed docker compose version result
set_fact:
docker_compose_desired_version_installed: "{{ docker_compose_version_installed_result.rc == 0 }}"
- name: install docker-compose
become: 'true'
get_url:
url: 'https://github.com/docker/compose/releases/download/1.19.0/docker-compose-{{ ansible_system }}-{{ ansible_architecture }}'
dest: '/usr/local/bin/docker-compose'
force: true
mode: '555'
when: docker_compose_desired_version_installed == false
- name: install local user tools
hosts: localhost
sudo: false
tasks:
# can only run once
- name: install nvm
shell: 'curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash'
ignore_errors: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment