mirror of
https://github.com/kevinveenbirkenbach/client-playbook.git
synced 2024-12-27 18:25:05 +01:00
Added swapfile and ssh configuration role
This commit is contained in:
parent
61cfdc3470
commit
2db6b4beba
29
README.md
29
README.md
@ -1,4 +1,6 @@
|
||||
# Client Playbook
|
||||
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
|
||||
|
||||
Playbook to setup Manjaro GNOME clients.
|
||||
# Setup
|
||||
|
||||
@ -11,33 +13,6 @@ ansible-galaxy collection install -r requirements.yml
|
||||
- add ssh
|
||||
# Refactor
|
||||
```bash
|
||||
FSTAB_SWAP_ENTRY="/swapfile none swap defaults 0 0"
|
||||
SWAP_FILE="/swapfile"
|
||||
FSTAB_FILE="/etc/fstab"
|
||||
if grep -q "$FSTAB_SWAP_ENTRY" "$FSTAB_FILE"; then
|
||||
info "Skipping creation of swap partion because entry allready exists in \"$FSTAB_FILE\"!"
|
||||
else
|
||||
info "Creating swap partition..." &&
|
||||
sudo fallocate -l 16G "$SWAP_FILE" &&
|
||||
sudo chmod 600 "$SWAP_FILE" &&
|
||||
sudo mkswap "$SWAP_FILE" &&
|
||||
sudo swapon "$SWAP_FILE" &&
|
||||
sudo sh -c "echo \"$FSTAB_SWAP_ENTRY\">>\"$FSTAB_FILE\"" || error "Creation of swap partition failed."
|
||||
fi
|
||||
|
||||
info "Setup SSH key..."
|
||||
ssh_key_path="$HOME/.ssh/id_rsa"
|
||||
if [ ! -f "$ssh_key_path" ]; then
|
||||
info "SSH key $ssh_key_path doesn't exists!"
|
||||
if [ ! -f "./data$ssh_key_path" ]; then
|
||||
info "Importing ssh key by copying data..." &&
|
||||
bash "$SCRIPT_PATH""/data/export-to-system.sh" || error "Copying failed."
|
||||
else
|
||||
info "Generating ssh key..." &&
|
||||
ssh-keygen -t rsa -b 4096 -C "$USER@$HOSTNAME" || error "Key generation failed."
|
||||
fi
|
||||
fi
|
||||
|
||||
info "Setup, configuration and installation of dependencies for installed software..."
|
||||
|
||||
if pacman -Qi "arduino" > /dev/null ; then
|
||||
|
10
playbook.yml
10
playbook.yml
@ -12,6 +12,16 @@
|
||||
become: true
|
||||
roles:
|
||||
- native-gnome
|
||||
- name: setup ssh hosts
|
||||
hosts: ssh_hosts
|
||||
become: false
|
||||
roles:
|
||||
- native-ssh
|
||||
- name: setup swapfile hosts
|
||||
hosts: swapfile_hosts
|
||||
become: false
|
||||
roles:
|
||||
- role: native-swapfile
|
||||
- name: setup gaming hosts
|
||||
hosts: gaming_hosts
|
||||
become: true
|
||||
|
2
roles/native-ssh/meta/main.yml
Normal file
2
roles/native-ssh/meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- native-git
|
5
roles/native-ssh/tasks copy/main.yml
Normal file
5
roles/native-ssh/tasks copy/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
- name: Install caffeine
|
||||
kewlfft.aur.aur:
|
||||
use: yay
|
||||
name:
|
||||
- caffeine-ng
|
6
roles/native-ssh/tasks/main.yml
Normal file
6
roles/native-ssh/tasks/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
- name: pull ssh repository from {{ssh_configuration_repository}}
|
||||
git:
|
||||
repo: "{{ssh_configuration_repository}}"
|
||||
dest: "$HOME/.ssh"
|
||||
update: yes
|
||||
become: false
|
2
roles/native-swapfile/meta/main.yml
Normal file
2
roles/native-swapfile/meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- native-git
|
10
roles/native-swapfile/tasks/main.yml
Normal file
10
roles/native-swapfile/tasks/main.yml
Normal file
@ -0,0 +1,10 @@
|
||||
- name: pull swapfile creating script
|
||||
git:
|
||||
repo: "git@github.com:kevinveenbirkenbach/create-linux-swapfile.git"
|
||||
dest: "$HOME/Repositories/github.com/kevinveenbirkenbach/create-linux-swapfile"
|
||||
update: yes
|
||||
become: false
|
||||
|
||||
- name: Execute create swapfile script
|
||||
ansible.builtin.shell: bash "/home/{{client_username}}/Repositories/github.com/kevinveenbirkenbach/create-linux-swapfile/create-linux-swapfile.sh" "{{swapfile_size}}"
|
||||
become: true
|
Loading…
Reference in New Issue
Block a user