some more roles

This commit is contained in:
Christopher Beckmann
2024-03-22 16:15:03 +01:00
parent 0506eb2665
commit 54f1ca03cd
6 changed files with 86 additions and 11 deletions

View File

@@ -2,5 +2,6 @@
roles:
- role: general
- role: bat
- role: lsd
# - role: lsd
- role: cheat
- role: bw

View File

@@ -1 +1,2 @@
- src: community.general
- src: bitwarden.secrets

View File

@@ -1,3 +1,8 @@
- name: Create .cargo folder
file:
state: directory
dest: "{{ ansible_user_dir }}/.cargo"
- name: Install bat
community.general.cargo:
name: bat

View File

@@ -1,7 +1,46 @@
# Check if bw can be run
# Run bw --version
- name: Install Bitwarden SDK
pip:
name: bitwarden-sdk
# Run curl https://vault.bitwarden.com/download/?app=cli&platform=linux
# Check for Version String -> Update if newer
- name: Check if Bitwarden CLI is installed
command: bw --version
register: installed
changed_when: no
ignore_errors: true
# Add configuration files
- name: Check for newest version
shell: |
curl 'https://vault.bitwarden.com/download/?app=cli&platform=linux' -si | grep -oP 'location: .*bw-linux-\K.*\.zip' | cut -d . -f -3
register: current
changed_when: no
when: installed is success
ignore_errors: true
- name: Print return information from the installed Bitwarden
ansible.builtin.debug:
var: installed
verbosity: 2
- name: Print return information from the newest Bitwarden CLI version
ansible.builtin.debug:
var: current
verbosity: 2
- name: Install Bitwarden CLI
become: true
when: installed is failed or installed.stdout is version(current.stdout, '<')
shell: |
curl -O -J -L "https://vault.bitwarden.com/download/?app=cli&platform=linux"
rm -rf /usr/bin/bw
unzip bw-*.zip -d /usr/bin/
rm -rf bw-*.zip
- name: Configure Bitwarden CLI
shell: |
bw config server https://bitwarden.cbeck.tech
# - name: Test
# ansible.builtin.debug:
# msg: >-
# {{ lookup('community.general.bitwarden', 'SySS', field='password') }}

View File

@@ -5,7 +5,7 @@
name:
- cargo
- name: Add Go to PATH
- name: Add Cargo to PATH
lineinfile:
path: "{{ ansible_user_dir }}/.zshrc"
insertafter: 'export PATH="$PATH.*'

View File

@@ -1,8 +1,37 @@
- name: check go version
command: /usr/local/go/bin/go version
register: result
changed_when: no
ignore_errors: true
- name: Install Go
become: true
package:
name:
- golang
when: result is failed
shell: |
wget "https://go.dev/dl/go1.22.1.linux-amd64.tar.gz"
rm -rf /usr/local/go
tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz
rm -rf go1.22.1.linux-amd64.tar.gz
# - name: Install Go
# become: true
# package:
# name:
# - golang
#
#wget "https://go.dev/$(curl https://go.dev/dl/ | grep downloadBox.*linux | cut -d '"' -f 4 | cut -c2-)"
- name: Add go binary path to PATH
lineinfile:
path: "{{ ansible_user_dir }}/.profile"
insertafter: 'export PATH="$PATH.*'
line: 'export PATH="$PATH:/usr/local/go/bin:{{ ansible_user_dir }}/go/bin"'
regexp: 'export PATH="$PATH:/usr/local/go/bin:{{ ansible_user_dir }}/go/bin"'
create: true
state: present
# - name: Source profile
# shell: . "{{ ansible_user_dir }}/.profile"
- name: check go version
command: go version
@@ -19,7 +48,7 @@
go_path: "{{ lookup('env', 'GOPATH') | default(ansible_env.HOME+'/go', true) }}"
when: result is succeeded
- name: Add Go to PATH
- name: Add Go programs to PATH
lineinfile:
path: "{{ ansible_user_dir }}/.zshrc"
insertafter: 'export PATH="$PATH.*'