Compare commits
23
Commits
8bde23573c
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
227bb41259
|
||
|
|
161ce95e7e
|
||
|
|
36cbf9861f
|
||
|
|
322a14a882
|
||
|
|
7ce23b6fa4
|
||
|
|
999595a699
|
||
|
|
4d6fcdee6f
|
||
|
|
e7f0d5e453
|
||
|
|
1843173e25
|
||
|
|
06d0065f69
|
||
|
|
ca805a8db4
|
||
|
|
0b364a1bd4
|
||
|
|
92012be667
|
||
|
|
a06e02c7cc
|
||
|
|
829e8225f6
|
||
|
|
e07b18b587
|
||
|
|
b17d8649ea
|
||
|
|
307dd26339
|
||
|
|
b9a1648a6f
|
||
|
|
c26d236db1 | ||
|
|
114f3dbf5e | ||
|
|
3a346acfb6 | ||
|
|
c8d13e274e |
No files matched your search
+2
-1
@@ -41,7 +41,8 @@ tags: []
|
||||
# collection label 'namespace.name'. The value is a version range
|
||||
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
|
||||
# range specifiers can be set and are separated by ','
|
||||
dependencies: {}
|
||||
dependencies:
|
||||
community.general: ">=13.0.0<14.0.0"
|
||||
|
||||
# The URL of the originating SCM repository
|
||||
repository: https://gitea.kevinnlsamuel.com/kevinnlsamuel/galaxy
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- hosts:
|
||||
- tmp.kevinnlsamuel.com
|
||||
vars:
|
||||
ansible_user: root
|
||||
alt_ssh_port: 1023
|
||||
name: setup server natsuco
|
||||
|
||||
roles:
|
||||
- kevinnlsamuel.galaxy.sshd.disablepasswd
|
||||
- kevinnlsamuel.galaxy.sshd.altport
|
||||
tasks:
|
||||
@@ -0,0 +1 @@
|
||||
Port {{ alt_ssh_port }}
|
||||
@@ -1,3 +0,0 @@
|
||||
[defaults]
|
||||
inventory = ./hosts.ini
|
||||
vault_password_file = ./secrets-client
|
||||
@@ -1,13 +1,20 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
name: setup desktop
|
||||
vars_files:
|
||||
- secrets
|
||||
- hosts:
|
||||
- 127.0.0.1
|
||||
connection: local
|
||||
name: setup fedora workstation
|
||||
|
||||
module_defaults:
|
||||
ansible.builtin.dnf:
|
||||
install_weak_deps: false
|
||||
|
||||
tasks:
|
||||
|
||||
- name: remove fedora fluff
|
||||
become: true
|
||||
ansible.builtin.dnf:
|
||||
state: absent
|
||||
allowerasing: true
|
||||
autoremove: true
|
||||
name:
|
||||
@@ -18,12 +25,11 @@
|
||||
- python3-botocore
|
||||
- firefox
|
||||
- nodejs
|
||||
state: absent
|
||||
|
||||
- name: install core components
|
||||
become: true
|
||||
ansible.builtin.dnf:
|
||||
state: present
|
||||
install_weak_deps: false
|
||||
name:
|
||||
- git
|
||||
- git-crypt
|
||||
@@ -43,6 +49,7 @@
|
||||
- mosh
|
||||
- unzip
|
||||
- flatpak
|
||||
|
||||
- name: install pup
|
||||
become: true
|
||||
unarchive:
|
||||
@@ -50,35 +57,31 @@
|
||||
creates: /usr/local/bin/pup
|
||||
dest: /usr/local/bin/
|
||||
src: https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip
|
||||
- name: install google-chrome dnf repository
|
||||
become: true
|
||||
copy:
|
||||
dest: /etc/yum.repos.d/google-chrome.repo
|
||||
content: |
|
||||
[google-chrome]
|
||||
name=google-chrome
|
||||
baseurl=https://dl.google.com/linux/chrome/rpm/stable/x86_64
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://dl.google.com/linux/linux_signing_key.pub
|
||||
- name: install tailscale dnf repository
|
||||
become: true
|
||||
copy:
|
||||
dest: /etc/yum.repos.d/tailscale.repo
|
||||
content: |
|
||||
[tailscale]
|
||||
name=Tailscale
|
||||
baseurl=https://pkgs.tailscale.com/stable/fedora/$basearch
|
||||
enabled=1
|
||||
type=rpm
|
||||
repo_gpgcheck=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://pkgs.tailscale.com/stable/fedora/repo.gpg
|
||||
|
||||
- name: install dnf repos
|
||||
include_role:
|
||||
role: installdnfrepo
|
||||
loop:
|
||||
- id: googlechrome
|
||||
baseurl: https://dl.google.com/linux/chrome/rpm/stable/x86_64
|
||||
gpgkey: https://dl.google.com/linux/linux_signing_key.pub
|
||||
|
||||
- id: wayscriber
|
||||
baseurl: https://wayscriber.com/rpm
|
||||
gpgkey: https://wayscriber.com/rpm/RPM-GPG-KEY-wayscriber.asc
|
||||
|
||||
- id: tailscale
|
||||
baseurl: https://pkgs.tailscale.com/stable/fedora/$basearch
|
||||
gpgkey: https://pkgs.tailscale.com/stable/fedora/repo.gpg
|
||||
|
||||
- id: charmcli
|
||||
baseurl: https://repo.charm.sh/yum/
|
||||
gpgkey: https://repo.charm.sh/yum/gpg.key
|
||||
|
||||
- name: install dnf packages
|
||||
become: true
|
||||
ansible.builtin.dnf:
|
||||
state: present
|
||||
install_weak_deps: false
|
||||
name:
|
||||
- aria2
|
||||
- bat
|
||||
@@ -87,6 +90,7 @@
|
||||
- btrfs-progs
|
||||
- coreutils
|
||||
- moreutils
|
||||
- parallel
|
||||
- fcitx5-gtk4
|
||||
- file
|
||||
- gh
|
||||
@@ -119,6 +123,10 @@
|
||||
- wkhtmltopdf
|
||||
- yq
|
||||
- ImageMagick
|
||||
- wayscriber
|
||||
- qt6ct
|
||||
- trash-cli
|
||||
|
||||
- name: install flatpak applications
|
||||
become: true
|
||||
flatpak:
|
||||
@@ -127,12 +135,13 @@
|
||||
- https://valent.andyholmes.ca/valent.flatpakref
|
||||
- com.nextcloud.desktopclient.nextcloud
|
||||
- org.libreoffice.LibreOffice
|
||||
- org.mozilla.Thunderbird
|
||||
- org.mozilla.thunderbird_esr
|
||||
|
||||
- com.logseq.Logseq
|
||||
- com.github.xournalpp.xournalpp
|
||||
|
||||
- com.obsproject.Studio
|
||||
- com.obsproject.Studio.Plugin.DroidCam
|
||||
|
||||
- com.yubico.yubioath
|
||||
- com.github.tchx84.Flatseal
|
||||
@@ -151,39 +160,27 @@
|
||||
- org.inkscape.Inkscape
|
||||
- org.darktable.Darktable
|
||||
- org.audacityteam.Audacity
|
||||
|
||||
- name: create group myself
|
||||
become: true
|
||||
group:
|
||||
name: myself
|
||||
gid: 690
|
||||
system: true
|
||||
- name: create group rootlessmen
|
||||
become: true
|
||||
group:
|
||||
name: rootlessmen
|
||||
system: true
|
||||
|
||||
- name: create users
|
||||
become: true
|
||||
with_items:
|
||||
loop:
|
||||
- name: kevins
|
||||
uid: 6901
|
||||
groups: ["myself", "rootlessmen"]
|
||||
groups: ["wheel", "myself"]
|
||||
- name: kevinsamuel
|
||||
uid: 6902
|
||||
groups: myself
|
||||
groups: ["myself"]
|
||||
- name: kevinnlsamuel
|
||||
uid: 6903
|
||||
groups: ["myself", "rootlessmen"]
|
||||
user:
|
||||
state: present
|
||||
name: "{{ item.name }}"
|
||||
uid: "{{ item.uid }}"
|
||||
groups: "{{ item.groups }}"
|
||||
skeleton: /dev/null
|
||||
append: true
|
||||
password: $1$aBLdYKQI$iB3ZfYF.QPCwVhgnkROUX.
|
||||
update_password: on_create
|
||||
shell: /bin/zsh
|
||||
groups: ["myself"]
|
||||
ansible.builtin.include_role:
|
||||
role: createworkstationuser
|
||||
|
||||
- name: use crun as podman engine
|
||||
become: true
|
||||
@@ -202,15 +199,8 @@
|
||||
path: "{{file}}"
|
||||
line: 'runtime = "/usr/bin/runc"'
|
||||
search_string: 'runtime = '
|
||||
- name: create storage for rootlessmen
|
||||
become: true
|
||||
file:
|
||||
path: /var/lib/rootlessmen
|
||||
owner: root
|
||||
group: rootlessmen
|
||||
mode: "0770"
|
||||
state: directory
|
||||
- name: setup podman to use rootlessmen for storage
|
||||
|
||||
- name: setup podman btrfs storage
|
||||
become: true
|
||||
vars:
|
||||
file: /etc/containers/storage.conf
|
||||
@@ -224,27 +214,12 @@
|
||||
path: "{{file}}"
|
||||
line: "[storage]"
|
||||
insertbefore: BOF
|
||||
- name: setup storage config to use rootlessmen
|
||||
with_items:
|
||||
- line: 'driver_priority = ["btrfs", "overlay", "vfs"]'
|
||||
search_string: 'driver_priority = '
|
||||
- line: 'rootless_storage_path = "/var/lib/rootlessmen/$USER/storage"'
|
||||
search_string: 'rootless_storage_path = '
|
||||
|
||||
- name: set podman storage config to btrfs
|
||||
lineinfile:
|
||||
path: "{{file}}"
|
||||
line: "{{item.line}}"
|
||||
search_string: "{{item.search_string}}"
|
||||
- name: set selinux fcontext for rootlessmen
|
||||
become: true
|
||||
with_items:
|
||||
- pathspec: /var/lib/rootlessmen/[^/]+/storage/artifacts(/.*)?
|
||||
type: container_ro_file_t
|
||||
- pathspec: /var/lib/rootlessmen/[^/]+/storage/volumes/[^/]*/.*
|
||||
type: container_file_t
|
||||
sefcontext:
|
||||
target: "{{item.pathspec}}"
|
||||
setype: "{{item.type}}"
|
||||
seuser: unconfined_u
|
||||
line: 'driver_priority = ["btrfs", "overlay", "vfs"]'
|
||||
search_string: 'driver_priority = '
|
||||
|
||||
- name: enable tpm-tss in dracut
|
||||
become: true
|
||||
@@ -256,6 +231,7 @@
|
||||
mode: "1644"
|
||||
create: true
|
||||
state: present
|
||||
|
||||
- name: tell PAM to unlock gnome-keyring in tty
|
||||
become: true
|
||||
with_items:
|
||||
@@ -313,6 +289,18 @@
|
||||
firewall-cmd --permanent --zone home --add-service=kdeconnect --add-service=mosh --add-service=ssh
|
||||
firewall-cmd --reload
|
||||
|
||||
- import_role:
|
||||
role: managegooglechrome
|
||||
become: true
|
||||
name: set chrome policies
|
||||
|
||||
- name: enabled tailscaled service
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: tailscaled
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: create /home/myself
|
||||
become: true
|
||||
file:
|
||||
@@ -321,12 +309,14 @@
|
||||
group: myself
|
||||
owner: kevins
|
||||
mode: '2770'
|
||||
|
||||
- name: check if HOME.git is cloned
|
||||
become: true
|
||||
become_user: kevins
|
||||
register: home_repo
|
||||
stat:
|
||||
path: /home/myself/HOME.git/HEAD
|
||||
|
||||
- name: "clone HOME.git"
|
||||
become: true
|
||||
become_user: kevins
|
||||
@@ -339,7 +329,7 @@
|
||||
origin \
|
||||
-t stable \
|
||||
-m stable \
|
||||
https://{{PAT}}@github.com/kevinnlsamuel/HOME.git
|
||||
git@github.com:kevinnlsamuel/HOME.git
|
||||
git fetch --set-upstream origin stable
|
||||
|
||||
- name: clone HOME to my selves
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
@@ -1,3 +0,0 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# defaults file for .
|
||||
@@ -1,3 +0,0 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# handlers file for .
|
||||
@@ -1,3 +0,0 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# tasks file for .
|
||||
@@ -1,3 +0,0 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
localhost
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- .
|
||||
@@ -1,3 +0,0 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# vars file for .
|
||||
@@ -1,28 +1,28 @@
|
||||
- ansible.builtin.include_role:
|
||||
role: ensureparentdir
|
||||
apply:
|
||||
- ansible.builtin.import_role:
|
||||
role: ensuredir
|
||||
become: true
|
||||
vars:
|
||||
path: "{{ path }}"
|
||||
path: "{{ subvpath | dirname }}"
|
||||
|
||||
- name: check if btrfs subv exists
|
||||
register: btrfssubvexists
|
||||
become: true
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
ansible.builtin.shell: "btrfs subv list {{ path | mandatory | dirname }} | grep -qF {{ path | basename }}"
|
||||
ansible.builtin.shell: "btrfs subv list {{ subvpath | mandatory | dirname }} | grep -qF {{ subvpath | basename }}"
|
||||
|
||||
- block:
|
||||
- name: "create btrfs subv {{ path | mandatory }}"
|
||||
- name: "create btrfs subv {{ subvpath | mandatory }}"
|
||||
when: btrfssubvexists.rc != 0
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
cmd: "btrfs subv create {{ path }}"
|
||||
- name: "set owner:group of subv {{ path }}"
|
||||
cmd: "btrfs subv create {{ subvpath }}"
|
||||
- name: "set owner:group of subv {{ subvpath }}"
|
||||
when: btrfssubvexists.rc != 0
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
state: touch
|
||||
path: "{{ path | mandatory }}"
|
||||
path: "{{ subvpath | mandatory }}"
|
||||
owner: "{{ owner | mandatory }}"
|
||||
group: "{{ group | default(owner) }}"
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,18 @@
|
||||
- become: true
|
||||
user:
|
||||
state: present
|
||||
name: "{{ item.name }}"
|
||||
uid: "{{ item.uid }}"
|
||||
groups: "{{ item.groups }}"
|
||||
skeleton: /dev/null
|
||||
append: true
|
||||
password: $1$aBLdYKQI$iB3ZfYF.QPCwVhgnkROUX.
|
||||
update_password: on_create
|
||||
shell: /bin/zsh
|
||||
- name: "create subv for containers"
|
||||
ansible.builtin.include_role:
|
||||
role: createbtrfssubv
|
||||
apply:
|
||||
vars:
|
||||
subvpath: "/home/{{ item.name }}/.local/share/containers"
|
||||
owner: "{{ item.name }}"
|
||||
@@ -0,0 +1,6 @@
|
||||
galaxy_info:
|
||||
author: kevinnlsamuel
|
||||
description: sayin hello
|
||||
dependencies:
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
@@ -1,29 +1,28 @@
|
||||
- name: check if parent dir exists
|
||||
- name: check if dir exists
|
||||
register: stat_output
|
||||
ansible.builtin.stat:
|
||||
path: "{{ path | dirname }}"
|
||||
path: "{{ path }}"
|
||||
|
||||
- name: create dir if not exists
|
||||
when: not stat_output.stat.exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ path | dirname }}"
|
||||
path: "{{ path }}"
|
||||
state: directory
|
||||
|
||||
- name: backup and create dir if not dir
|
||||
when: stat_output.stat.exists and not stat_output.stat.isdir
|
||||
block:
|
||||
- name: "backup existing {{ path | dirname }}"
|
||||
- name: "backup existing {{ path }}"
|
||||
no_log: true
|
||||
ansible.builtin.copy:
|
||||
src: "{{ path | dirname }}"
|
||||
dest: "{{ path | dirname }}.old"
|
||||
- name: "delete existing {{ path | dirname }}"
|
||||
src: "{{ path }}"
|
||||
dest: "{{ path }}.old"
|
||||
- name: "delete existing {{ path }}"
|
||||
no_log: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ path | dirname }}"
|
||||
path: "{{ path }}"
|
||||
state: absent
|
||||
- name: "create {{ path | dirname }}"
|
||||
no_log: true
|
||||
- name: "create {{ path }}"
|
||||
ansible.builtin.file:
|
||||
path: "{{ path | dirname }}"
|
||||
path: "{{ path }}"
|
||||
state: directory
|
||||
@@ -0,0 +1,6 @@
|
||||
galaxy_info:
|
||||
author: kevinnlsamuel
|
||||
description: sayin hello
|
||||
dependencies:
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
@@ -0,0 +1,8 @@
|
||||
- name: "install {{ item.id | default( id ) | mandatory }} dnf repository"
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
dest: "/etc/yum.repos.d/{{ item.id | default( id ) | mandatory }}.repo"
|
||||
src: dnfrepo.j2
|
||||
owner: root
|
||||
group: root
|
||||
mode: 644
|
||||
@@ -0,0 +1,7 @@
|
||||
[{{ item.id | default( id ) | mandatory }}]
|
||||
name={{ item.id | default( id ) | mandatory }}
|
||||
baseurl={{ item.baseurl | default( baseurl ) | mandatory }}
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
repo_gpgcheck=1
|
||||
gpgkey={{ item.gpgkey | default( gpgkey ) | mandatory }}
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,16 @@
|
||||
- name: manage google chrome
|
||||
block:
|
||||
|
||||
- ansible.builtin.file:
|
||||
path: /etc/opt/chrome/policies/managed/
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
|
||||
- ansible.builtin.copy:
|
||||
src: disable-local-llm.json
|
||||
dest: /etc/opt/chrome/policies/managed/disable-local-llm.json
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: restart sshd
|
||||
service:
|
||||
name: sshd
|
||||
state: restarted
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
/home/kevins/Projects/galaxy/roles/sshd/_handlers
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: change ssh port to {{ alt_ssh_port | mandatory }}
|
||||
notify: restart sshd
|
||||
template:
|
||||
src: 00-altport.conf
|
||||
dest: /etc/ssh/sshd_config.d/00-altport.conf
|
||||
- name: install semanage
|
||||
when: ansible_facts.selinux.status != 'disabled'
|
||||
dnf:
|
||||
state: present
|
||||
name: policycoreutils-python-utils
|
||||
- name: give sshd access to alt port on selinux
|
||||
register: result_change_to_alt_port
|
||||
ignore_errors: true
|
||||
changed_when: "'already defined' not in result_change_to_alt_port.stdout"
|
||||
command: semanage port -a -t ssh_port_t -p tcp {{ alt_ssh_port }}
|
||||
@@ -0,0 +1 @@
|
||||
Port {{ alt_ssh_port }}
|
||||
@@ -0,0 +1 @@
|
||||
PasswordAuthentication no
|
||||
+1
@@ -0,0 +1 @@
|
||||
/home/kevins/Projects/galaxy/roles/sshd/_handlers
|
||||
@@ -0,0 +1,5 @@
|
||||
- name: disable password auth
|
||||
notify: restart sshd
|
||||
copy:
|
||||
src: 00-nopasswd.conf
|
||||
dest: /etc/ssh/sshd_config.d/00-nopasswd.conf
|
||||
Reference in new issue
Block a user