commit 46bdf4dda000f698bddcc4396ba60651ca26c75a Author: ProgramSnail Date: Sun Aug 3 12:33:33 2025 +0300 init, dotfiles and install basic roles diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f417b60 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**.ssh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4ce46ed --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "distrobox-ansible"] + path = distrobox-ansible + url = https://github.com/sandorex/distrobox-ansible.git diff --git a/README.md b/README.md new file mode 100644 index 0000000..71b7c40 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +Trying to build auto system setup with ansible + +--- + +This repo is based on https://github.com/sandorex/config diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..aa2a389 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,14 @@ +[defaults] +# use more readable condensed callback +stdout_callback = unixy +display_ok_hosts = false +display_skipped_hosts = false + +# disable warnings +localhost_warning = False + +# load everything from this repo +# roles, plugins, vars, etc +home = . + +connection_plugins = ./plugins/connection/:./distrobox-ansible/plugins/connection/ diff --git a/distrobox-ansible b/distrobox-ansible new file mode 160000 index 0000000..cd2db6e --- /dev/null +++ b/distrobox-ansible @@ -0,0 +1 @@ +Subproject commit cd2db6e499e64f21a7d79d1506ec6ff999d91333 diff --git a/roles/dotfiles/tasks/bash.yml b/roles/dotfiles/tasks/bash.yml new file mode 100644 index 0000000..c97335d --- /dev/null +++ b/roles/dotfiles/tasks/bash.yml @@ -0,0 +1,27 @@ +- name: Link bashrc + ansible.builtin.file: + src: '{{ role_path }}/files/.bashrc' + dest: '{{ ansible_env.HOME }}/.bashrc' + state: link + force: true + +- name: Link inputrc + ansible.builtin.file: + src: '{{ role_path }}/files/.inputrc' + dest: '{{ ansible_env.HOME }}/.inputrc' + state: link + force: true + +- name: Link profile + ansible.builtin.file: + src: '{{ role_path }}/files/.profile' + dest: '{{ ansible_env.HOME }}/.profile' + state: link + force: true + +- name: Link bash profile + ansible.builtin.file: + src: '{{ role_path }}/files/.bash_profile' + dest: '{{ ansible_env.HOME }}/.bash_profile' + state: link + force: true diff --git a/roles/dotfiles/tasks/cli.yml b/roles/dotfiles/tasks/cli.yml new file mode 100644 index 0000000..4ebf2ec --- /dev/null +++ b/roles/dotfiles/tasks/cli.yml @@ -0,0 +1,34 @@ + +# shell +- ansible.builtin.import_tasks: bash.yml + +- name: Link fish configuration directory + ansible.builtin.file: + src: '{{ role_path }}/files/.config/fish' + dest: '{{ ansible_env.HOME }}/.config/fish' + state: link + force: true + +# apps +- name: Link tmux configuration + ansible.builtin.file: + src: '{{ role_path }}/files/.tmux.conf' + dest: '{{ ansible_env.HOME }}/.tmux.conf' + state: link + force: true + +# TODO: set server keys +- name: Link tmate configuration + ansible.builtin.file: + src: '{{ role_path }}/files/.tmate.conf' + dest: '{{ ansible_env.HOME }}/.tmate.conf' + state: link + force: true + +- name: Link helix configuration + ansible.builtin.file: + src: '{{ role_path }}/files/.config/helix' + dest: '{{ ansible_env.HOME }}/.config/helix' + state: link + force: true + diff --git a/roles/dotfiles/tasks/de.yml b/roles/dotfiles/tasks/de.yml new file mode 100644 index 0000000..4640904 --- /dev/null +++ b/roles/dotfiles/tasks/de.yml @@ -0,0 +1 @@ +# TODO diff --git a/roles/dotfiles/tasks/git.yml b/roles/dotfiles/tasks/git.yml new file mode 100644 index 0000000..dc8b914 --- /dev/null +++ b/roles/dotfiles/tasks/git.yml @@ -0,0 +1,6 @@ +- name: Link gitconfig + ansible.builtin.file: + src: '{{ role_path }}/files/.gitconfig' + dest: '{{ ansible_env.HOME }}/.gitconfig' + state: link + force: true diff --git a/roles/dotfiles/tasks/gui.yml b/roles/dotfiles/tasks/gui.yml new file mode 100644 index 0000000..7720b05 --- /dev/null +++ b/roles/dotfiles/tasks/gui.yml @@ -0,0 +1,20 @@ +- name: Link kitty configuration directory + ansible.builtin.file: + src: '{{ role_path }}/files/.config/kitty' + dest: '{{ ansible_env.HOME }}/.config/kitty' + state: link + force: true + +- name: Link alacritty configuration file + ansible.builtin.file: + src: '{{ role_path }}/files/.alacritty.toml' + dest: '{{ ansible_env.HOME }}/.alacritty.toml' + state: link + force: true + +- name: Link alacritty configuration directory + ansible.builtin.file: + src: '{{ role_path }}/files/.config/alacritty' + dest: '{{ ansible_env.HOME }}/.config/alacritty' + state: link + force: true diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml new file mode 100644 index 0000000..1ea6cdd --- /dev/null +++ b/roles/dotfiles/tasks/main.yml @@ -0,0 +1,21 @@ +- ansible.builtin.import_tasks: bash.yml + when: "'bash' in configure" + +- ansible.builtin.import_tasks: cli.yml + when: "'cli' in configure" + +- ansible.builtin.import_tasks: git.yml + when: "'git' in configure" + +- ansible.builtin.import_tasks: ssh.yml + when: "'ssh' in configure" + +- ansible.builtin.import_tasks: gui.yml + when: "'gui' in configure" + +- ansible.builtin.import_tasks: scripts.yml + when: "'scripts' in configure" + +- ansible.builtin.import_tasks: de.yml + when: "'de' in configure" + diff --git a/roles/dotfiles/tasks/scripts.yml b/roles/dotfiles/tasks/scripts.yml new file mode 100644 index 0000000..4fe66ec --- /dev/null +++ b/roles/dotfiles/tasks/scripts.yml @@ -0,0 +1,6 @@ +- name: Link scripts directory + ansible.builtin.file: + src: '{{ role_path }}/files/.bin' + dest: '{{ ansible_env.HOME }}/.bin' + state: link + force: true diff --git a/roles/dotfiles/tasks/ssh.yml b/roles/dotfiles/tasks/ssh.yml new file mode 100644 index 0000000..699ead0 --- /dev/null +++ b/roles/dotfiles/tasks/ssh.yml @@ -0,0 +1,10 @@ +# TODO: create keys ?? +# TODO: copy directory ?? + +# create .ssh in files by hand, use everywere automatically +- name: Link gitconfig + ansible.builtin.file: + src: '{{ role_path }}/files/.ssh' + dest: '{{ ansible_env.HOME }}/.ssh' + state: link + force: true diff --git a/roles/installs/tasks/build.yml b/roles/installs/tasks/build.yml new file mode 100644 index 0000000..a9d2d19 --- /dev/null +++ b/roles/installs/tasks/build.yml @@ -0,0 +1,9 @@ +- name: Install common packages + ansible.builtin.dnf5: + name: + - openssl + - perl + - ninja-build + - git + state: latest + diff --git a/roles/installs/tasks/cli.yml b/roles/installs/tasks/cli.yml new file mode 100644 index 0000000..3c09574 --- /dev/null +++ b/roles/installs/tasks/cli.yml @@ -0,0 +1,23 @@ +- name: Install cli tools + ansible.builtin.dnf5: + name: + # shell utils + - just + - fish + - jsonnet + + # edit utils + - helix + - micro + - tmux + - tmate + - ripgrep + + # git + - git-delta + - git + + - ansible + + state: latest + diff --git a/roles/installs/tasks/cpp.yml b/roles/installs/tasks/cpp.yml new file mode 100644 index 0000000..7be2dfe --- /dev/null +++ b/roles/installs/tasks/cpp.yml @@ -0,0 +1,20 @@ +- ansible.builtin.import_tasks: build.yml + +- name: Install tools for cpp dev + ansible.builtin.dnf5: + name: + - make + - cmake + - xmake + + - clang + - clang-tools + - clang-tools-extra + - clang-devel + - clang-tools-devel + - clang-tools-extra-devel + - clang-libs + + - doxygen + + state: latest diff --git a/roles/installs/tasks/gui.yml b/roles/installs/tasks/gui.yml new file mode 100644 index 0000000..a82bd51 --- /dev/null +++ b/roles/installs/tasks/gui.yml @@ -0,0 +1,18 @@ +- name: Install gui tools + ansible.builtin.dnf5: + name: + - jetbrains-mono-fonts + + - kitty + - kitty-fish-integration + - alacritty + + - kate + - okular + - gwenview + - filelight + + - qt5-qtvirtualkeyboard + - hunspell-ru + state: latest + diff --git a/roles/installs/tasks/host.yml b/roles/installs/tasks/host.yml new file mode 100644 index 0000000..81916b3 --- /dev/null +++ b/roles/installs/tasks/host.yml @@ -0,0 +1,10 @@ +- name: Install cli tools for bare metal host + ansible.builtin.dnf5: + name: + - distrobox + - syncthing + - lm_sensors + - powertop + - ansible + state: latest + diff --git a/roles/installs/tasks/javascript.yml b/roles/installs/tasks/javascript.yml new file mode 100644 index 0000000..f889a37 --- /dev/null +++ b/roles/installs/tasks/javascript.yml @@ -0,0 +1,25 @@ +- name: Install nodejs + ansible.builtin.dnf5: + name: + - nodejs + - curl + state: latest + +- name: Curl is required for bun + ansible.builtin.dnf5: + name: + - curl + state: latest + +- name: Install bun + ansible.builtin.shell: + cmd: npm install -g bun + +- name: Get programs list to check fish presence + ansible.builtin.package_facts: + manager: auto + +- name: Update fish path + ansible.builtin.shell: + cmd: echo 'fish_add_path {{ ansible_env.HOME }}/.bun/bin' + when: "'fish' in ansible_facts.packages" diff --git a/roles/installs/tasks/lang.yml b/roles/installs/tasks/lang.yml new file mode 100644 index 0000000..2aee739 --- /dev/null +++ b/roles/installs/tasks/lang.yml @@ -0,0 +1,9 @@ +- ansible.builtin.import_tasks: cpp.yml + +- name: Install tools for lang dev + ansible.builtin.dnf5: + name: + - tree-sitter-cli + - libtree-sitter + - libtree-sitter-devel + state: latest diff --git a/roles/installs/tasks/main.yml b/roles/installs/tasks/main.yml new file mode 100644 index 0000000..dfca4fc --- /dev/null +++ b/roles/installs/tasks/main.yml @@ -0,0 +1,20 @@ +- ansible.builtin.import_tasks: build.yml + when: "'build' in apps" + +- ansible.builtin.import_tasks: cli.yml + when: "'cli' in apps" + +- ansible.builtin.import_tasks: cpp.yml + when: "'cpp' in apps" + +- ansible.builtin.import_tasks: lang.yml + when: "'lang' in apps" + +- ansible.builtin.import_tasks: javascript.yml + when: "'javascript' in apps" + +- ansible.builtin.import_tasks: gui.yml + when: "'gui' in apps" + +- ansible.builtin.import_tasks: host.yml + when: "'host' in apps"