update
This commit is contained in:
parent
1110cf573c
commit
0e46b7c6be
32 changed files with 799 additions and 0 deletions
3
ansible/scripts/configure_bat.yml
Normal file
3
ansible/scripts/configure_bat.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
- name: Build Bat Cache
|
||||
become_user: user
|
||||
shell: "bat cache --build"
|
||||
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
|
||||
}
|
||||
}
|
||||
7
ansible/scripts/configure_groups.yml
Normal file
7
ansible/scripts/configure_groups.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
- name: adding existing user '{{ user }}' to group sudo
|
||||
user:
|
||||
groups: '{{ item }}'
|
||||
name: user
|
||||
append: yes
|
||||
with_items: "{{ user_groups }}"
|
||||
when: user_groups is defined
|
||||
12
ansible/scripts/configure_qemu.yml
Normal file
12
ansible/scripts/configure_qemu.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
- name: set default network
|
||||
shell: "{{ item }}"
|
||||
with_items:
|
||||
- "virsh net-start default"
|
||||
- "virsh net-autostart default"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: add user to libvirt
|
||||
user:
|
||||
name: user
|
||||
groups: libvirt,libvirt-qemu,kvm,input,disk
|
||||
append: yes
|
||||
14
ansible/scripts/configure_ssh.yml
Normal file
14
ansible/scripts/configure_ssh.yml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
- name: Create ssh folder
|
||||
become_user: user
|
||||
ansible.builtin.file:
|
||||
path: ~/.ssh
|
||||
owner: "user"
|
||||
group: "user"
|
||||
mode: '0700'
|
||||
state: directory
|
||||
|
||||
- name: Generate an OpenSSH keypair
|
||||
become_user: user
|
||||
community.crypto.openssh_keypair:
|
||||
path: ~/.ssh/id_ed25519
|
||||
type: ed25519
|
||||
30
ansible/scripts/configure_systemd.yml
Normal file
30
ansible/scripts/configure_systemd.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
- name: Copy .service files from files folder to /etc/systemd/system
|
||||
find:
|
||||
paths: "files/"
|
||||
hidden: yes
|
||||
file_type: file
|
||||
patterns: "*.service"
|
||||
register: service_files
|
||||
|
||||
- name: Copy each .service file to systemd directory
|
||||
copy:
|
||||
src: "{{ item.path }}"
|
||||
dest: "/etc/systemd/system"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
with_items: "{{ service_files.files }}"
|
||||
when: service_files is defined
|
||||
|
||||
- name: Combine predefined list and filesystem paths
|
||||
set_fact:
|
||||
systemd_service: "{{ systemd_service | union(service_files.files | map(attribute='path') | map('basename')) | unique }}"
|
||||
when: service_files is defined
|
||||
|
||||
- name: Enable Systemd Services
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: true
|
||||
with_items: "{{ systemd_service }}"
|
||||
when: systemd_service is defined
|
||||
36
ansible/scripts/install_apt.yml
Normal file
36
ansible/scripts/install_apt.yml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
- name: download gpg
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ item.url }}"
|
||||
dest: "/etc/apt/keyrings/{{ item.name }}.asc"
|
||||
with_items: "{{ apt_repo_gpg }}"
|
||||
become: yes
|
||||
when: apt_repo_gpg is defined
|
||||
|
||||
- name: add apt repository key
|
||||
apt_key:
|
||||
url: "{{ item }}"
|
||||
with_items: "{{ apt_keys }}"
|
||||
become: yes
|
||||
when: apt_keys is defined
|
||||
|
||||
- name: add apt repository
|
||||
apt_repository:
|
||||
repo: "{{ item }}"
|
||||
with_items: "{{ apt_repo }}"
|
||||
become: yes
|
||||
when: apt_repo is defined
|
||||
|
||||
- name: Upgrade Packages
|
||||
package:
|
||||
update_cache: yes
|
||||
upgrade: safe
|
||||
become: yes
|
||||
when: required_packages_apt is defined
|
||||
|
||||
- name: Install Packages
|
||||
apt:
|
||||
state: latest
|
||||
update_cache: yes
|
||||
pkg: "{{ required_packages_apt }}"
|
||||
become: yes
|
||||
when: required_packages_apt is defined
|
||||
49
ansible/scripts/install_brew.yml
Normal file
49
ansible/scripts/install_brew.yml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
- name: Ensuring Homebrew Is Installed
|
||||
stat:
|
||||
path: /home/linuxbrew/.linuxbrew/bin/
|
||||
register: homebrew_check
|
||||
when: required_packages_brew is defined
|
||||
|
||||
- name: Fail If Homebrew Is Not Installed and install_homebrew_if_missing Is False
|
||||
fail:
|
||||
msg: Homebrew is missing, install from http://brew.sh
|
||||
when:
|
||||
- required_packages_brew is defined
|
||||
- not homebrew_check.stat.exists
|
||||
- not install_homebrew_if_missing
|
||||
|
||||
- name: Installing Homebrew
|
||||
become_user: user
|
||||
shell: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
when:
|
||||
- required_packages_brew is defined
|
||||
- not homebrew_check.stat.exists
|
||||
- install_homebrew_if_missing
|
||||
|
||||
- name: Load Brew shellenv
|
||||
become_user: user
|
||||
shell: eval "$(/home/linuxbrew/.linuxbrew/bin brew shellenv)"
|
||||
when:
|
||||
- required_packages_brew is defined
|
||||
- not homebrew_check.stat.exists
|
||||
- install_homebrew_if_missing
|
||||
|
||||
- name: Install Brew Taps
|
||||
become_user: user
|
||||
community.general.homebrew_tap:
|
||||
name: "{{ item }}"
|
||||
with_items: "{{ required_taps }}"
|
||||
when: required_taps is defined
|
||||
|
||||
- name: Install Brew Casks
|
||||
become_user: user
|
||||
community.general.homebrew_cask:
|
||||
name: "{{ item }}"
|
||||
with_items: "{{ required_packages_casks }}"
|
||||
when: required_packages_casks is defined
|
||||
|
||||
- name: Install Brew Packages
|
||||
become_user: user
|
||||
community.general.homebrew:
|
||||
name: "{{ required_packages_brew }}"
|
||||
when: required_packages_brew is defined
|
||||
22
ansible/scripts/install_flatpak.yml
Normal file
22
ansible/scripts/install_flatpak.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
- name: configure flatpak
|
||||
community.general.flatpak_remote:
|
||||
name: "{{ item.name }}"
|
||||
state: present
|
||||
flatpakrepo_url: "{{ item.url }}"
|
||||
method: system
|
||||
with_items: "{{ flatpak_remote }}"
|
||||
when: flatpak_remote is defined
|
||||
|
||||
- name: update flatpaks
|
||||
become_user: user
|
||||
shell:
|
||||
cmd: flatpak update --noninteractive
|
||||
when: required_packages_flatpak is defined
|
||||
|
||||
- name: install flatpak
|
||||
become_user: user
|
||||
community.general.flatpak:
|
||||
name: "{{ item }}"
|
||||
with_items: "{{ required_packages_flatpak }}"
|
||||
when: required_packages_flatpak is defined
|
||||
ignore_errors: yes
|
||||
23
ansible/scripts/install_fonts.yml
Normal file
23
ansible/scripts/install_fonts.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
- name: ensure fonts directory
|
||||
become_user: user
|
||||
file:
|
||||
path: "~/.fonts"
|
||||
state: directory
|
||||
when: fonts is defined
|
||||
|
||||
- name: Ensuring Fonts Exists
|
||||
become_user: user
|
||||
shell: "ls ~/.fonts/*{{ item.name }}*"
|
||||
register: fonts_exist
|
||||
ignore_errors: yes
|
||||
with_items: "{{ fonts }}"
|
||||
when: fonts is defined
|
||||
|
||||
- name: Download Fonts
|
||||
when: fonts_exist is failed
|
||||
become_user: user
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ item.url }}"
|
||||
dest: "~/.fonts/"
|
||||
remote_src: yes
|
||||
with_items: "{{ fonts }}"
|
||||
36
ansible/scripts/install_go.yml
Normal file
36
ansible/scripts/install_go.yml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
- name: Register the current Go version (if any)
|
||||
command: go version
|
||||
ignore_errors: yes
|
||||
register: go_version
|
||||
changed_when: false
|
||||
|
||||
- name: Download the Go tarball
|
||||
get_url:
|
||||
url: "https://go.dev/dl/{{ go_tarball }}"
|
||||
dest: /usr/local/src/{{ go_tarball }}
|
||||
checksum: "{{ go_checksum }}"
|
||||
#when: go_version|failed or go_version.stdout != go_version_target
|
||||
|
||||
- name: Remove old installation of Go
|
||||
file:
|
||||
path: /usr/local/go
|
||||
state: absent
|
||||
#when: go_version|failed or go_version.stdout != go_version_target
|
||||
|
||||
- name: Extract the Go tarball if Go is not yet installed or not the desired version
|
||||
unarchive:
|
||||
src: /usr/local/src/{{ go_tarball }}
|
||||
dest: /usr/local
|
||||
copy: no
|
||||
#when: go_version|failed or go_version.stdout != go_version_target
|
||||
|
||||
- name: Add the Go bin directory to the PATH environment variable for all users
|
||||
copy:
|
||||
src: go-bin.sh
|
||||
dest: /etc/profile.d
|
||||
|
||||
- name: Set GOPATH for all users
|
||||
copy:
|
||||
src: go-path.sh
|
||||
dest: /etc/profile.d
|
||||
#when: set_go_path
|
||||
9
ansible/scripts/install_goapps.yml
Normal file
9
ansible/scripts/install_goapps.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
- name: Installing Go apps
|
||||
become_user: user
|
||||
shell: "go install {{ item }}"
|
||||
with_items: "{{ go_apps }}"
|
||||
when: go_apps is defined
|
||||
|
||||
- name: Build Bat Cache
|
||||
become_user: user
|
||||
shell: "bat cache --build"
|
||||
7
ansible/scripts/install_local_ca.yml
Normal file
7
ansible/scripts/install_local_ca.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
- name: Copy Public certs
|
||||
copy:
|
||||
src: durp.crt
|
||||
dest: /etc/ca-certificates/trust-source/anchors/durp.crt
|
||||
|
||||
- name: Trust certs
|
||||
command: trust extract-compat
|
||||
14
ansible/scripts/install_pacman.yml
Normal file
14
ansible/scripts/install_pacman.yml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
- name: Upgrade Packages
|
||||
community.general.pacman:
|
||||
state: latest
|
||||
update_cache: yes
|
||||
become: yes
|
||||
when: required_packages_pacman is defined
|
||||
|
||||
- name: Install Packages
|
||||
community.general.pacman:
|
||||
state: present
|
||||
update_cache: yes
|
||||
name: "{{ required_packages_pacman }}"
|
||||
become: yes
|
||||
when: required_packages_pacman is defined
|
||||
4
ansible/scripts/install_tpm.yml
Normal file
4
ansible/scripts/install_tpm.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- name: Install tmux TPM
|
||||
become_user: user
|
||||
shell: "git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm"
|
||||
ignore_errors: yes
|
||||
Loading…
Add table
Add a link
Reference in a new issue