From 6cdaec53ac63e8af98b328bd7ca45d61277ca2d0 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Tue, 1 May 2018 14:25:21 +0000 Subject: [PATCH] [meta] irregular apocalypse ruby/rust installation updates --- ansible/irregular-apocalypse.yml | 35 ++++++++++++++++++- ansible/irregular-apocalypse/chruby.yml | 16 ++++----- ansible/irregular-apocalypse/ruby-install.yml | 11 +++--- ansible/irregular-apocalypse/rustup.yml | 9 +++++ 4 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 ansible/irregular-apocalypse/rustup.yml diff --git a/ansible/irregular-apocalypse.yml b/ansible/irregular-apocalypse.yml index ce7094d..a880529 100644 --- a/ansible/irregular-apocalypse.yml +++ b/ansible/irregular-apocalypse.yml @@ -27,6 +27,16 @@ - dotfiles - zsh +- hosts: all + name: create home dirs + tasks: + - file: + path: "{{ item }}" + state: directory + with_items: + - src + - tmp + - hosts: all name: install Ansible tasks: @@ -48,7 +58,7 @@ version: 0.3.9 when: chruby.stat.exists == False - - stat: path=/usr/bin/local/ruby-install + - stat: path=/usr/local/bin/ruby-install register: ruby_install - import_tasks: irregular-apocalypse/ruby-install.yml vars: @@ -59,3 +69,26 @@ register: rubies - command: ruby-install ruby when: rubies.stat.exists == False + +- hosts: all + name: install Rust + tasks: + - stat: path=~/.cargo/bin/rustup + register: rustup + - import_tasks: irregular-apocalypse/rustup.yml + when: rustup.stat.exists == False + + - command: ~/.cargo/bin/rustup toolchain list + register: rustup_toolchains + - name: install rust + command: ~/.cargo/bin/rustup install nightly + when: "'nightly' not in rustup_toolchains.stdout" + + - name: default to nightly + command: ~/.cargo/bin/rustup default nightly + + - name: install Rust-based tools + command: ~/.cargo/bin/cargo install {{ item }} + with_items: + - exa + - ripgrep diff --git a/ansible/irregular-apocalypse/chruby.yml b/ansible/irregular-apocalypse/chruby.yml index 3371573..0366adf 100644 --- a/ansible/irregular-apocalypse/chruby.yml +++ b/ansible/irregular-apocalypse/chruby.yml @@ -1,21 +1,17 @@ -- name: create ~/src - file: - path: ~/src - state: directory - - name: download chruby get_url: url: https://github.com/postmodern/chruby/archive/v{{ version }}.tar.gz - dest: ~/src/chruby-{{ version }}.tar.gz + dest: ~/tmp/chruby-{{ version }}.tar.gz + force: yes - name: extract chruby unarchive: - src: ~/src/chruby-{{ version }}.tar.gz - dest: ~/src - remote_src: yes + tmp: ~/tmp/chruby-{{ version }}.tar.gz + dest: ~/tmp + remote_tmp: yes - name: install chruby command: make install args: - chdir: "{{ ansible_env.HOME }}/src/chruby-{{ version }}" + chdir: "{{ ansible_env.HOME }}/tmp/chruby-{{ version }}" become: yes diff --git a/ansible/irregular-apocalypse/ruby-install.yml b/ansible/irregular-apocalypse/ruby-install.yml index c0650d1..bd4994a 100644 --- a/ansible/irregular-apocalypse/ruby-install.yml +++ b/ansible/irregular-apocalypse/ruby-install.yml @@ -1,16 +1,17 @@ - name: download ruby-install get_url: url: https://github.com/postmodern/ruby-install/archive/v{{ version }}.tar.gz - dest: ~/src/ruby-install-{{ version }}.tar.gz + dest: ~/tmp/ruby-install-{{ version }}.tar.gz + force: yes - name: extract ruby-install unarchive: - src: ~/src/ruby-install-{{ version }}.tar.gz - dest: ~/src - remote_src: yes + tmp: ~/tmp/ruby-install-{{ version }}.tar.gz + dest: ~/tmp + remote_tmp: yes - name: install ruby-install command: make install args: - chdir: "{{ ansible_env.HOME }}/src/ruby-install-{{ version }}" + chdir: "{{ ansible_env.HOME }}/tmp/ruby-install-{{ version }}" become: yes diff --git a/ansible/irregular-apocalypse/rustup.yml b/ansible/irregular-apocalypse/rustup.yml new file mode 100644 index 0000000..a98b1d4 --- /dev/null +++ b/ansible/irregular-apocalypse/rustup.yml @@ -0,0 +1,9 @@ +- name: download rustup + get_url: + url: https://sh.rustup.rs + dest: ~/tmp/rustup-init.sh + force: yes + mode: a+x + +- name: install rustup + command: ~/tmp/rustup-init.sh -y