Code snippets used in blog post "Automating My Dev Setup": https://pbassiner.github.io/blog/automating_my_dev_setup.html
-
-
Save pbassiner/073a681726ce742db1b4e87de5f75cda to your computer and use it in GitHub Desktop.
Blog Post - Automating My Dev Setup: Ansible and bash script snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- include_vars: vars.yml | |
- name: Download binary files | |
become: yes | |
get_url: url={{ item.value.url }} dest=/usr/local/bin/{{ item.value.name }} validate_certs=no mode=0755 force=yes | |
with_dict: "{{ binaries }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- include_vars: vars.yml | |
- name: Install .deb files | |
become: yes | |
apt: deb={{ item.value.url }} | |
with_dict: "{{ debs }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- include_vars: vars.yml | |
- name: Add apt keys | |
become: yes | |
apt_key: keyserver={{ item.value.keyserver }} id={{ item.value.key }} | |
with_dict: "{{ repositories }}" | |
- name: Add apt repositories | |
become: yes | |
apt_repository: repo={{ item.value.repository }} | |
with_dict: "{{ repositories }}" | |
- name: Install packages | |
become: yes | |
apt: pkg={{ item }} state=latest update_cache=true | |
with_items: "{{ packages }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Install base packages | |
sudo: yes | |
apt: | |
name: {{ item }} | |
state: latest | |
update_cache: true | |
with_items: | |
- foo | |
- bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Install the package "foo" | |
apt: | |
name: foo | |
state: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- include_vars: vars.yml | |
- name: Download .tar.gz files | |
get_url: url={{ item.value.url }} dest=/tmp/{{ item.key }}.tar.gz validate_certs=no | |
with_dict: "{{ targzs }}" | |
- name: Extract .tar.gz files | |
unarchive: src=/tmp/{{ item.key }}.tar.gz dest={{ item.value.target_dir }} | |
with_dict: "{{ targzs }}" | |
- name: Symlink extracted folders | |
file: path={{ item.value.target_dir }}/{{ item.value.symlinked_dir }} src={{ item.value.target_dir }}/{{ item.value.original_dir }} state=link | |
with_dict: "{{ targzs }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
home: /home/user | |
repositories: | |
docker: | |
repository: deb https://apt.dockerproject.org/repo ubuntu-xenial main | |
keyserver: hkp://p80.pool.sks-keyservers.net:80 | |
key: 58118E89F3A912897C070ADBF76221572C52609D | |
packages: | |
- vim | |
- zsh | |
- terminator | |
debs: | |
atom: | |
name: Atom | |
url: https://atom.io/download/deb | |
plugins: | |
- file-icons | |
- language-scala | |
- atom-scalariform | |
targzs: | |
intellij: | |
name: IntelliJ IDEA | |
url: https://download.jetbrains.com/idea/ideaIC-2016.2.5.tar.gz | |
target_dir: "{{ home }}" | |
original_dir: idea-IC-162.2228.15 | |
symlinked_dir: ideaIC | |
binaries: | |
kubectl: | |
name: kubectl | |
url: https://storage.googleapis.com/kubernetes-release/release/v1.4.6/bin/linux/amd64/kubectl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-add-repository ppa:ansible/ansible | |
sudo apt-add-repository ppa:git-core/ppa | |
sudo apt-get update | |
sudo apt-get --assume-yes upgrade | |
sudo apt-get --assume-yes install ansible | |
sudo apt-get --assume-yes install git | |
git clone https://github.com/pbassiner/dev-env.git .dev-env | |
cd .dev-env | |
ansible-playbook ubuntu.yml -i hosts -vv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment