added several ansible roles
This commit is contained in:
15
ansible/roles/general/tasks/cargo.yml
Normal file
15
ansible/roles/general/tasks/cargo.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
- name: Install Cargo
|
||||
become: true
|
||||
package:
|
||||
name:
|
||||
- cargo
|
||||
|
||||
- name: Add Go to PATH
|
||||
lineinfile:
|
||||
path: "{{ ansible_user_dir }}/.zshrc"
|
||||
insertafter: 'export PATH="$PATH.*'
|
||||
regexp: 'export PATH="$PATH:{{ ansible_user_dir }}/\.cargo/bin"'
|
||||
line: 'export PATH="$PATH:{{ ansible_user_dir }}/.cargo/bin"'
|
||||
|
||||
|
||||
29
ansible/roles/general/tasks/go.yml
Normal file
29
ansible/roles/general/tasks/go.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
- name: Install Go
|
||||
become: true
|
||||
package:
|
||||
name:
|
||||
- golang
|
||||
|
||||
- name: check go version
|
||||
command: go version
|
||||
register: result
|
||||
changed_when: no
|
||||
ignore_errors: true
|
||||
|
||||
- name: Print return information from the previous task
|
||||
ansible.builtin.debug:
|
||||
var: result
|
||||
verbosity: 2
|
||||
|
||||
- set_fact:
|
||||
go_path: "{{ lookup('env', 'GOPATH') | default(ansible_env.HOME+'/go', true) }}"
|
||||
when: result is succeeded
|
||||
|
||||
- name: Add Go to PATH
|
||||
lineinfile:
|
||||
path: "{{ ansible_user_dir }}/.zshrc"
|
||||
insertafter: 'export PATH="$PATH.*'
|
||||
regexp: 'export PATH="$PATH:{{ ansible_user_dir }}/go/bin"'
|
||||
line: 'export PATH="$PATH:{{ ansible_user_dir }}/go/bin"'
|
||||
|
||||
|
||||
7
ansible/roles/general/tasks/main.yml
Normal file
7
ansible/roles/general/tasks/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
- name: Install Cargo
|
||||
include_tasks:
|
||||
file: cargo.yml
|
||||
|
||||
- name: Install Go
|
||||
include_tasks:
|
||||
file: go.yml
|
||||
Reference in New Issue
Block a user