-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate bootstrap to ansible playbooks (#184)
Migrate bootstrap to ansible playbooks
- Loading branch information
1 parent
577e406
commit 7bfed06
Showing
14 changed files
with
297 additions
and
500 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,5 @@ okta.pem | |
.env | ||
|
||
attic | ||
|
||
.idea/ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
- name: install certbot | ||
get_url: | ||
url: "https://dl.eff.org/certbot-auto" | ||
dest: "{{ transmute_bin }}/certbot-auto" | ||
remote_src: yes | ||
mode: 0755 | ||
|
||
- name: certbot-auto --noninteractive | ||
shell: "certbot-auto --noninteractive" | ||
args: | ||
chdir: "{{ transmute_bin }}" | ||
ignore_errors: yes |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
- name: install packages | ||
package: | ||
name: "{{ item }}" | ||
state: present | ||
become: yes | ||
with_items: | ||
- libncurses5-dev | ||
- libslang2-dev | ||
- gettext | ||
- zlib1g-dev | ||
- libselinux1-dev | ||
- debhelper | ||
- lsb-release | ||
- pkg-config | ||
- po-debconf | ||
- autoconf | ||
- automake | ||
- autopoint | ||
- libtool | ||
- bison | ||
- curl | ||
- git | ||
- socat | ||
- jq | ||
- virtualbox | ||
|
||
- name: create temporary directory NSENTER_TMP | ||
tempfile: | ||
state: directory | ||
suffix: NSENTER_TMP | ||
register: tmp | ||
|
||
- name: Unarchive util-linux | ||
unarchive: | ||
src: "https://www.kernel.org/pub/linux/utils/util-linux/v2.30/util-linux-2.30.2.tar.gz" | ||
dest: "{{ tmp.path }}" | ||
remote_src: yes | ||
|
||
- name: build nsenter | ||
shell: "./autogen.sh && ./configure && make nsenter" | ||
args: | ||
chdir: "{{ tmp.path }}/util-linux-2.30.2" | ||
|
||
- name: Create dir {{ transmute_bin }} | ||
file: | ||
path: "{{ ansible_env.HOME }}/.local/bin" | ||
state: directory | ||
recurse: yes | ||
|
||
- name: Copy nsenter | ||
copy: | ||
src: "{{ tmp.path }}/util-linux-2.30.2/nsenter" | ||
dest: "{{ ansible_env.HOME }}/.local/bin/nsenter" | ||
remote_src: yes | ||
mode: 0750 | ||
|
||
- name: Copy nsenter | ||
copy: | ||
src: "{{ tmp.path }}/util-linux-2.30.2/nsenter" | ||
dest: "/usr/bin/nsenter" | ||
remote_src: yes | ||
mode: 0755 | ||
become: yes | ||
|
||
- name: install kubectl | ||
get_url: | ||
url: "https://storage.googleapis.com/kubernetes-release/release/{{ transmute_kube_version }}/bin/linux/amd64/kubectl" | ||
dest: "/usr/local/bin/kubectl" | ||
remote_src: yes | ||
mode: 0755 | ||
owner: 0 | ||
group: 0 | ||
become: yes | ||
|
||
- name: install minikube | ||
get_url: | ||
url: "https://storage.googleapis.com/minikube/releases/v0.25.2/minikube-linux-amd64" | ||
dest: "/usr/local/bin/minikube" | ||
remote_src: yes | ||
mode: 0755 | ||
owner: 0 | ||
group: 0 | ||
become: yes | ||
|
||
- name: create temporary directory HELM_TMP | ||
tempfile: | ||
state: directory | ||
suffix: HELM_TMP | ||
register: tmp | ||
|
||
- name: Unarchive helm | ||
unarchive: | ||
src: "https://storage.googleapis.com/kubernetes-helm/helm-v2.8.2-linux-amd64.tar.gz" | ||
dest: "{{ tmp.path }}" | ||
remote_src: yes | ||
|
||
- name: Copy helm | ||
copy: | ||
src: "{{ tmp.path }}/linux-amd64/helm" | ||
dest: "{{ ansible_env.HOME }}/.transmute/bin/helm" | ||
remote_src: yes | ||
mode: 0750 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
- name: install homebrews | ||
homebrew: | ||
name: "{{ item }}" | ||
state: present | ||
with_items: | ||
- kubectl | ||
- kubernetes-helm | ||
- kubernetes-cli | ||
- coreutils | ||
- curl | ||
- git | ||
- socat | ||
- jq | ||
|
||
- name: link kubernetes-cli | ||
homebrew: | ||
name: "kubernetes-cli" | ||
state: linked | ||
ignore_errors: yes | ||
|
||
- name: install gnupg | ||
homebrew: | ||
name: "gnupg" | ||
state: present | ||
ignore_errors: yes | ||
|
||
- name: install minikube | ||
homebrew_cask: | ||
name: "minikube" | ||
state: present | ||
|
||
|
||
- name: install virtualbox | ||
homebrew_cask: | ||
name: "virtualbox" | ||
state: present | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
|
||
- include: linux.yml | ||
when: "ansible_system == 'Linux' and ansible_machine == 'x86_64'" | ||
|
||
- include: macos.yml | ||
when: "ansible_system == 'Darwin' and ansible_machine == 'x86_64'" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
|
||
- name: touch {{ ansible_env.HOME }}/.zshrc | ||
file: | ||
path: "{{ ansible_env.HOME }}/.zshrc" | ||
state: touch | ||
|
||
- name: touch {{ ansible_env.HOME }}/.bashrc | ||
file: | ||
path: "{{ ansible_env.HOME }}/.bashrc" | ||
state: touch | ||
|
||
- name: set TRANSMUTE_BIN variable | ||
set_fact: transmute_bin="{{ ansible_env.HOME }}/.transmute/bin" | ||
|
||
- name: Create dir {{ transmute_bin }} | ||
file: | ||
path: "{{ transmute_bin }}" | ||
state: directory | ||
|
||
- name: add PATH to {{ ansible_env.HOME }}/.zshrc and {{ ansible_env.HOME }}/.bashrc | ||
lineinfile: | ||
path: "{{ item }}" | ||
line: 'export PATH={{ transmute_bin }}:$PATH' | ||
with_items: | ||
- "{{ ansible_env.HOME }}/.zshrc" | ||
- "{{ ansible_env.HOME }}/.bashrc" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- include: nvm_install.yml | ||
|
||
- include: npm_packages.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
- name: Install npm packages globally | ||
shell: 'bash -c "source {{ ansible_env.HOME }}/.nvm/nvm.sh && npm i -g {{ item }}"' | ||
with_items: | ||
- '--unsafe-perm ngrok' | ||
- '[email protected]' | ||
- '[email protected]' | ||
- 'transmute-cli' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
|
||
- name: check if nvm already installed | ||
stat: | ||
path: "{{ ansible_env.HOME }}/.nvm/nvm.sh" | ||
register: nvm_stat | ||
|
||
- name: create temporary directory NVM_TMP | ||
tempfile: | ||
state: directory | ||
suffix: NVM_TMP | ||
register: tmp | ||
when: nvm_stat.stat.isreg is not defined or not nvm_stat.stat.isreg | ||
|
||
- name: Download nvm installer | ||
get_url: | ||
url: https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | ||
dest: "{{ tmp.path }}/install.sh" | ||
mode: 0750 | ||
when: nvm_stat.stat.isreg is not defined or not nvm_stat.stat.isreg | ||
|
||
- name: install nvm | ||
shell: "{{ tmp.path }}/install.sh" | ||
when: nvm_stat.stat.isreg is not defined or not nvm_stat.stat.isreg | ||
|
||
- name: Source nvm in {{ ansible_env.HOME }}/.profile | ||
lineinfile: dest="{{ ansible_env.HOME }}/{{ item }}" line="source ~/.nvm/nvm.sh" create=yes | ||
with_items: | ||
- .profile | ||
- .bashrc | ||
|
||
- name: Install node | ||
shell: 'bash -c "source {{ ansible_env.HOME }}/.profile && nvm ls-remote --lts=carbon && nvm install --lts=carbon"' | ||
register: nvm_install_result | ||
changed_when: "'is already installed.' not in nvm_install_result.stdout" | ||
|
||
- name: Set default node version to carbon | ||
shell: 'bash -c "source {{ ansible_env.HOME }}/.profile && nvm alias default lts/carbon"' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: generate {{ ansible_env.HOME }}/.transmute/.env | ||
template: | ||
src: ".env.j2" | ||
dest: "{{ ansible_env.HOME }}/.transmute/.env" | ||
|
||
- name: Install npm packages globally | ||
shell: 'bash -c "source {{ ansible_env.HOME }}/.nvm/nvm.sh && npm i -g transmute-cli"' | ||
become: no |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
TRANSMUTE_VERBOSITY=10 | ||
TRANSMUTE_DIR={{ ansible_env.HOME }}/.transmute | ||
TRANSMUTE_BIN={{ transmute_bin }} | ||
TRANSMUTE_REPO={{ ansible_env.HOME }}/.transmute/git/transmute | ||
TRANSMUTE_KUBE_VERSION={{ transmute_kube_version }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
- name: transmute | ||
vars: | ||
fix_dotfiles: true | ||
transmute_kube_version: "v1.9.4" | ||
nvm_version: "v0.33.11" | ||
hosts: localhost | ||
connection: local | ||
gather_facts: yes | ||
roles: | ||
- role: dotfiles_install | ||
when: fix_dotfiles | ||
- role: dependencies | ||
- role: nvm | ||
- role: certbot | ||
- role: transmute |
Oops, something went wrong.