Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Significant Refactor #18

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
rust_c_compiler_package: gcc
rust_addtl_system_packages: []
rust_code_completion: true
rust_user_path: "/home/{{ rust_user }}/.cargo/bin:/home/{{ rust_user }}/.local/bin:/usr/local/bin/:/usr/bin:/bin"

rust_user_path: "/home/{{ rust_user }}/.local/bin:/home/{{ rust_user }}/.cargo/bin:/usr/local/bin/:/usr/bin:/bin"

rust_install_racer: false
rust_install_rls: false
rustup_components: []
rustup_default_toolchain: stable
rustup_toolchains: [stable]
1 change: 0 additions & 1 deletion handlers/main.yml

This file was deleted.

5 changes: 2 additions & 3 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ galaxy_info:
name: rust-dev
author: Naftuli Kay
description: Install and configure a Rust development environment on a system.
src: naftulikay.rust-dev

license: MIT

Expand All @@ -12,9 +13,7 @@ galaxy_info:
- name: EL
versions: [7]
- name: Ubuntu
versions: [trusty, xenial]
- name: elementary OS
versions: [loki]
versions: [bionic, trusty, xenial]

galaxy_tags: [rust,rust-lang]

Expand Down
39 changes: 0 additions & 39 deletions tasks/code-completion.yml

This file was deleted.

6 changes: 4 additions & 2 deletions tasks/discover/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
register: rust_user_home_check

- name: set rust user home
set_fact: rust_user_home="{{ rust_user_home_check.stdout_lines | first }}"
set_fact:
rust_user_home: "{{ rust_user_home_check.stdout_lines | first }}"

- name: check if rustup is installed
command: ls "{{ rust_user_home }}/.rustup"
command: "{{ rust_user_home }}/.cargo/bin/rustup --version"
register: rustup_check
become: true
become_user: "{{ rust_user }}"
changed_when: false
failed_when: false
Expand Down
39 changes: 6 additions & 33 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,8 @@
fail: msg="rust_user is not defined or empty, it must be set."
when: (rust_user is not defined) or (not rust_user)

# load per-os and per distro variables
- name: load ubuntu distribution variables
include_vars: ubuntu/common.yml
when: is_ubuntu_derivative

- name: load ubuntu distribution release variables
include_vars: |-
{%- if is_ubuntu_trusty_derivative -%}
ubuntu/trusty.yml
{%- elif is_ubuntu_xenial_derivative -%}
ubuntu/xenial.yml
{%- endif -%}
when: is_ubuntu_derivative and (is_ubuntu_trusty_derivative or is_ubuntu_xenial_derivative)

- name: load redhat distribution variables
include_vars: redhat/common.yml
when: is_redhat_derivative

- name: load redhat distribution release variables
include_vars: redhat/rhel7.yml
- name: load rhel variables
include_vars: redhat.yml
when: is_redhat_derivative

- name: discover rust facts
Expand All @@ -31,6 +13,7 @@
- name: install utility packages
include_tasks: utility-packages.yml

# FIXME this is bad, just stdout -> sh -c
- name: fetch rustup installer
get_url:
url: https://sh.rustup.rs
Expand Down Expand Up @@ -92,17 +75,7 @@


- name: install c compiler
package: name="{{ rust_c_compiler_package }}" state=present
package:
name: "{{ rust_c_compiler_package }}"
state=: present
become: true

- name: install additional system packages
package: name="{{ item }}" state=present
with_items: "{{ rust_addtl_system_packages }}"
become: true

- name: remove temp installer
file: name="{{ rustup_tmp_installer }}" state=absent

- name: install code completion tools
include_tasks: code-completion.yml
when: rust_code_completion | default(true) | bool
26 changes: 11 additions & 15 deletions tasks/utility-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,21 @@
when: is_ubuntu_derivative
become: true

- name: install git
package: name=git state=present
become: true

- name: install curl
package: name="{{ curl_package_name }}" state=present
become: true

- name: install rsync
package: name="{{ rsync_package_name }}" state=present
become: true

- name: install ssh client
package: name="{{ ssh_package_name }}" state=present
- name: install build utilities
package:
name: "{{ item }}"
state: present
with_items:
- "{{ curl_package_name }}"
- "{{ rsync_package_name }}"
- "{{ ssh_package_name }}"
become: true

# install python required packages on trusty
- name: install python SSL support packages
package: name="{{ item }}" state=present
package:
name: "{{ item }}"
state: present
with_items:
- ca-certificates
- python-dev
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion vars/redhat/rhel7.yml

This file was deleted.

1 change: 0 additions & 1 deletion vars/ubuntu/common.yml

This file was deleted.

1 change: 0 additions & 1 deletion vars/ubuntu/trusty.yml

This file was deleted.

1 change: 0 additions & 1 deletion vars/ubuntu/xenial.yml

This file was deleted.