update
This commit is contained in:
@@ -24,3 +24,18 @@ Set-PSReadLineOption -PredictionSource History
|
|||||||
|
|
||||||
$env:POWERSHELL_TELEMETRY_OPTOUT = 1
|
$env:POWERSHELL_TELEMETRY_OPTOUT = 1
|
||||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
|
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
|
||||||
|
|
||||||
|
$tokens = @(
|
||||||
|
@{
|
||||||
|
name = "GITLAB_TOKEN"
|
||||||
|
value = "cli-gitlab"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function unlockbw {
|
||||||
|
$env:BW_SESSION = "$(bw unlock --raw)"
|
||||||
|
|
||||||
|
foreach ($token in $tokens) {
|
||||||
|
Set-Variable -Name $token.name -Value $(bw get password $token.value) -Scope script
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
tmux/.config/tmux
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
.env
|
||||||
ansible
|
ansible
|
||||||
Makefile
|
Makefile
|
||||||
ansible.cfg
|
ansible.cfg
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -1,2 +1,5 @@
|
|||||||
|
include .env
|
||||||
|
export
|
||||||
|
|
||||||
run:
|
run:
|
||||||
ansible-playbook ./ansible/local.yml -K
|
ansible-playbook ./ansible/local.yml -K
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
connection: local
|
connection: local
|
||||||
become: true
|
become: true
|
||||||
|
vars:
|
||||||
|
GITLAB_TOKEN: "{{ lookup('env', 'GITLAB_TOKEN') }}"
|
||||||
# vars_prompt:
|
# vars_prompt:
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
- name: install fonts
|
- name: install fonts
|
||||||
include_tasks: "./scripts/install_fonts.yml"
|
include_tasks: "./scripts/install_fonts.yml"
|
||||||
|
|
||||||
|
- name: generate ssh keys
|
||||||
|
include_tasks: "./scripts/configure_ssh.yml"
|
||||||
|
|
||||||
|
- name: Configure Gitlab SSH
|
||||||
|
become_user: user
|
||||||
|
ansible.builtin.command: pwsh -f ./scripts/configure_gitlab.ps1 "{{ GITLAB_TOKEN }}"
|
||||||
|
|
||||||
- name: set gnome config
|
- name: set gnome config
|
||||||
become_user: user
|
become_user: user
|
||||||
dconf:
|
dconf:
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ required_packages_brew:
|
|||||||
- terraform
|
- terraform
|
||||||
- kubernetes-cli
|
- kubernetes-cli
|
||||||
- zsh-autosuggestions
|
- zsh-autosuggestions
|
||||||
|
- bitwarden-cli
|
||||||
|
|
||||||
apt_keys:
|
apt_keys:
|
||||||
- https://packages.microsoft.com/keys/microsoft.asc
|
- https://packages.microsoft.com/keys/microsoft.asc
|
||||||
|
|||||||
32
ansible/scripts/configure_gitlab.ps1
Normal file
32
ansible/scripts/configure_gitlab.ps1
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
param ($GITLAB_TOKEN)
|
||||||
|
if (!$GITLAB_TOKEN){
|
||||||
|
Write-Output "Please unlock Bitwarden"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
#Gitlab set ssh key
|
||||||
|
|
||||||
|
$header = @{
|
||||||
|
"PRIVATE-TOKEN"=$GITLAB_TOKEN
|
||||||
|
}
|
||||||
|
$GitlabAPI = "https://gitlab.com/api/v4"
|
||||||
|
|
||||||
|
$publickey = Get-Content ~/.ssh/id_ed25519.pub
|
||||||
|
|
||||||
|
$body = @{
|
||||||
|
title = "Ansible Script"
|
||||||
|
key = "$publickey"
|
||||||
|
} | ConvertTo-Json
|
||||||
|
|
||||||
|
Try{
|
||||||
|
Invoke-RestMethod -Headers $header -Uri $GitlabAPI/user/keys -Body $body -Method Post -ContentType application/json -ErrorVariable gitlabkey | Out-Null
|
||||||
|
}Catch{
|
||||||
|
if($gitlabkey -like "*Token is expired*"){
|
||||||
|
Write-Error "Token Has Expired"
|
||||||
|
exit -1
|
||||||
|
}
|
||||||
|
if($gitlabkey -notlike "*has already been taken*"){
|
||||||
|
Write-Error "Failed to upload key"
|
||||||
|
exit -1
|
||||||
|
}
|
||||||
|
}
|
||||||
5
ansible/scripts/configure_ssh.yml
Normal file
5
ansible/scripts/configure_ssh.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
- name: Generate an OpenSSH keypair
|
||||||
|
become_user: user
|
||||||
|
community.crypto.openssh_keypair:
|
||||||
|
path: ~/.ssh/id_ed25519
|
||||||
|
type: ed25519
|
||||||
Reference in New Issue
Block a user