diff --git a/collections/ansible_collections/nullified/infrastructure/roles/development/defaults/main.yml b/collections/ansible_collections/nullified/infrastructure/roles/development/defaults/main.yml index 7fac3ca..f3a9088 100644 --- a/collections/ansible_collections/nullified/infrastructure/roles/development/defaults/main.yml +++ b/collections/ansible_collections/nullified/infrastructure/roles/development/defaults/main.yml @@ -1,4 +1,5 @@ --- custom_github_token: "" development_docker_remap_user: "{{ custom_base_user_account }}" -development_docker_remap_group: "{{ custom_base_user_account }}" \ No newline at end of file +development_docker_remap_group: "{{ custom_base_user_account }}" +development_install_rust: false diff --git a/collections/ansible_collections/nullified/infrastructure/roles/development/tasks/main.yml b/collections/ansible_collections/nullified/infrastructure/roles/development/tasks/main.yml index 0c45f5c..85d0ed7 100644 --- a/collections/ansible_collections/nullified/infrastructure/roles/development/tasks/main.yml +++ b/collections/ansible_collections/nullified/infrastructure/roles/development/tasks/main.yml @@ -327,3 +327,29 @@ - venv: "flake8" extension: "pep8-naming" creates: "pep8ext_naming.py" + +- name: '[rust] check if rust is already installed' + ansible.builtin.file: + path: "{{ getent_passwd[custom_base_user_account][4] }}/.cargo/bin/rustc" + register: rustc_stat + changed_when: false + failed_when: false + when: development_install_rust | bool + +- name: '[rust] rust' + become: true + when: development_install_rust | bool and rustc_stat.state is match("absent") + block: + - name: '[rust] download installer' + ansible.builtin.get_url: + url: https://sh.rustup.rs + dest: /tmp/rustup.sh + mode: '0750' + owner: "{{ custom_base_user_account }}" + group: "{{ custom_base_user_account }}" + + - name: '[rust] install rust toolchain' + become_user: "{{ custom_base_user_account }}" + script: + cmd: /tmp/rustup.sh -qy + creates: "{{ getent_passwd[custom_base_user_account][4] }}/.cargo/bin/rustc" diff --git a/inventory/host_vars/unobtainium/vars.yml b/inventory/host_vars/unobtainium/vars.yml index 22cc91f..d894036 100644 --- a/inventory/host_vars/unobtainium/vars.yml +++ b/inventory/host_vars/unobtainium/vars.yml @@ -17,3 +17,5 @@ common_gitconfig_email: "{{ vault_common_gitconfig_email }}" common_gitconfig_force_sign: true common_gitconfig_signingkey: "{{ vault_common_gitconfig_signingkey }}" common_install_fonts: true + +development_install_rust: true