diff --git a/files/caddy/caddy.yml b/files/caddy/caddy.yml new file mode 100644 index 0000000..4f3241b --- /dev/null +++ b/files/caddy/caddy.yml @@ -0,0 +1,104 @@ +# Install and configure caddy reverse proxy +--- +- name: create caddy group + become: true + ansible.builtin.group: + name: "{{ caddy.group | default('caddy') }}" + state: present + system: true + tags: + - http + - caddy + - proxy + - user_group + +- name: create caddy user + become: true + ansible.builtin.user: + comment: caddy server user + create_home: true + group: "{{ caddy.group | default('caddy') }}" + name: "{{ caddy.user | default('caddy') }}" + state: present + system: true + password_lock: true + shell: /sbin/nologin + tags: + - http + - caddy + - proxy + - user_group + +- name: install caddy binary + become: true + ansible.builtin.copy: + dest: /usr/local/bin/caddy + group: root + owner: root + mode: '0755' + setype: bin_t + src: caddy/caddy + tags: + - http + - caddy + - proxy + - binary + +- name: install caddy systemd service + become: true + ansible.builtin.template: + backup: true + dest: /etc/systemd/system/caddy.service + group: root + owner: root + mode: '0640' + setype: systemd_unit_file_t + src: caddy/caddy.service.j2 + vars: + domain_name: "{{ nextcloud.domain_name }}" + user: "{{ caddy.user | default('caddy') }}" + group: "{{ caddy.group | default('caddy') }}" + envfile: "{{ caddy.envfile | default(omit) }}" + cmdpath: /usr/local/bin/caddy + extra_args: --environ + configfile: "{{ caddy.configfile | default('/etc/caddy/Caddyfile') }}" + timeout: 5s + capabilities: CAP_NET_ADMIN CAP_NET_BIND_SERVICE + tags: + - http + - caddy + - proxy + - service + - config + +- name: install Caddyfile + become: true + ansible.builtin.template: + backup: true + dest: /etc/caddy/Caddyfile + group: "{{ caddy.group | default('caddy') }}" + owner: "{{ caddy.user | default('caddy') }}" + mode: '0640' + setype: etc_t + src: caddy/Caddyfile.j2 + tags: + - http + - caddy + - proxy + - config + +- name: install .env file + become: true + when: + - caddy.env_vars is defined + - caddy.envfile is defined + ansible.builtin.copy: + dest: "{{ caddy.envfile }}" + group: root + owner: root + mode: '0600' + setype: etc_t + content: | + {{ caddy.env_vars }} + tags: + - caddy diff --git a/meta/argument_spec.yml b/meta/argument_spec.yml new file mode 100644 index 0000000..6aa26e5 --- /dev/null +++ b/meta/argument_spec.yml @@ -0,0 +1,43 @@ +--- +argument_specs: + main: + short_description: install software easily + description: + - Make the installation of packages consistent on each platform. + - Installs for RedHat, Debian or Darwin based systems. + author: + - Matthew Stobbs + options: + packages: + type: "list" + elements: "str" + required: true + description: | + The list of packages to install by name. + syspkglist: + type: "list" + elements: "str" + required: false + description: | + Additional packages to install via the system + default package manager. Is combined with the + completed list of packages to install. + Only use this if you a package isn't available to the role. + install_state: + type: "str" + choices: + - "present" + - "latest" + - "absent" + required: false + default: present + description: | + Desired state of the packages to install. + full_upgrade: + type: "bool" + required: false + default: false + description: | + Do a full system upgrade before installing + additional packages. This does not handle + rebooting a machine that has been upgraded. diff --git a/tasks/Darwin/alacritty.yml b/tasks/Darwin/alacritty.yml new file mode 100644 index 0000000..f60a4d6 --- /dev/null +++ b/tasks/Darwin/alacritty.yml @@ -0,0 +1,8 @@ +--- +- name: append alacritty to caskpkgs + set_fact: + caskpkgs: "{{ (caskpkgs | default([])) + [ 'alacritty' ] }}" + tags: + - MacOS + - brew + - package diff --git a/tasks/Darwin/ansible.yml b/tasks/Darwin/ansible.yml new file mode 100644 index 0000000..ff4df0d --- /dev/null +++ b/tasks/Darwin/ansible.yml @@ -0,0 +1,8 @@ +--- +- name: append ansible to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'ansible' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/btop.yml b/tasks/Darwin/btop.yml new file mode 100644 index 0000000..2aeca30 --- /dev/null +++ b/tasks/Darwin/btop.yml @@ -0,0 +1,8 @@ +--- +- name: append btop to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'btop' ]}}" + tags: + - MacOS + - brew + - package diff --git a/tasks/Darwin/carapace.yml b/tasks/Darwin/carapace.yml new file mode 100644 index 0000000..46a3112 --- /dev/null +++ b/tasks/Darwin/carapace.yml @@ -0,0 +1,9 @@ +--- +- name: append carapace to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'carapace' ] }}" + tags: + - MacOS + - homebrew + - package + - nushell diff --git a/tasks/Darwin/cmake.yml b/tasks/Darwin/cmake.yml new file mode 100644 index 0000000..15c14be --- /dev/null +++ b/tasks/Darwin/cmake.yml @@ -0,0 +1,8 @@ +--- +- name: append cmake to caskpkgs + set_fact: + caskpkgs: "{{ (caskpkgs | default([])) + [ 'homebrew/cask/cmake' ] }}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/editorconfig.yml b/tasks/Darwin/editorconfig.yml new file mode 100644 index 0000000..72b8cd0 --- /dev/null +++ b/tasks/Darwin/editorconfig.yml @@ -0,0 +1,8 @@ +--- +- name: append editorconfig to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'editorconfig' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/firefox.yml b/tasks/Darwin/firefox.yml new file mode 100644 index 0000000..0cd5db8 --- /dev/null +++ b/tasks/Darwin/firefox.yml @@ -0,0 +1,9 @@ +--- +- name: append firefox to caskpkgs + set_fact: + caskpkgs: "{{ (caskpkgs | default([])) + [ 'firefox' ] }}" + tags: + - packages + - MacOS + - homebrew + - web diff --git a/tasks/Darwin/fzf.yml b/tasks/Darwin/fzf.yml new file mode 100644 index 0000000..965299b --- /dev/null +++ b/tasks/Darwin/fzf.yml @@ -0,0 +1,8 @@ +--- +- name: append fzf to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'fzf' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/ghostty.yml b/tasks/Darwin/ghostty.yml new file mode 100644 index 0000000..762504a --- /dev/null +++ b/tasks/Darwin/ghostty.yml @@ -0,0 +1,9 @@ +--- +- name: append ghostty to caskpkgs + set_fact: + caskpkgs: "{{ (caskpkgs | default([])) + [ 'ghostty' ] }}" + tags: + - MacOS + - brew + - package + - terminal diff --git a/tasks/Darwin/git.yml b/tasks/Darwin/git.yml new file mode 100644 index 0000000..b0a898f --- /dev/null +++ b/tasks/Darwin/git.yml @@ -0,0 +1,20 @@ +--- +- name: set git_pkgs + set_fact: + git_pkgs: + - git + - git-delta + - git-extras + - git-lfs + tags: + - MacOS + - homebrew + - package + +- name: append git to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + git_pkgs }}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/go.yml b/tasks/Darwin/go.yml new file mode 100644 index 0000000..d13a774 --- /dev/null +++ b/tasks/Darwin/go.yml @@ -0,0 +1,35 @@ +--- +- name: Set go Filename + ansible.builtin.set_fact: + goFilename: "go{{ go.version }}.darwin-{{ arch[ansible_architecture] }}.{{ go.darwin.extension }}" + tags: + - dev + - go + +- name: Download latest go package for MacOS + become: true + ansible.builtin.get_url: + dest: "/tmp/{{ goFilename }}" + url: "https://go.dev/dl/{{ goFilename }}" + checksum: "sha256:{{ go.darwin.sum[ansible_architecture] }}" + decompress: false + tags: + - dev + - go + +- name: Install go MacOS use pkg file + become: true + ansible.builtin.command: + cmd: "installer -pkg /tmp/{{ goFilename }} -target /" + tags: + - dev + - go + +- name: Cleanup go package download + become: true + ansible.builtin.file: + path: "/tmp/{{ goFilename }}" + state: absent + tags: + - dev + - go diff --git a/tasks/Darwin/hugo.yml b/tasks/Darwin/hugo.yml new file mode 100644 index 0000000..eab1b4a --- /dev/null +++ b/tasks/Darwin/hugo.yml @@ -0,0 +1,8 @@ +--- +- name: append hugo to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'hugo' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/iterm2.yml b/tasks/Darwin/iterm2.yml new file mode 100644 index 0000000..fd8e140 --- /dev/null +++ b/tasks/Darwin/iterm2.yml @@ -0,0 +1,4 @@ +--- +- name: append iterm2 to caskpkgs + set_fact: + caskpkgs: "{{ (caskpkgs | default([])) + [ 'iterm2' ] }}" diff --git a/tasks/Darwin/jq.yml b/tasks/Darwin/jq.yml new file mode 100644 index 0000000..a161487 --- /dev/null +++ b/tasks/Darwin/jq.yml @@ -0,0 +1,8 @@ +--- +- name: append jq to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'jq' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/neovide.yml b/tasks/Darwin/neovide.yml new file mode 100644 index 0000000..e604d6d --- /dev/null +++ b/tasks/Darwin/neovide.yml @@ -0,0 +1,4 @@ +--- +- name: append neovide to caskpkgs + set_fact: + caskpkgs: "{{ (caskpkgs | default([])) + [ 'neovide' ] }}" diff --git a/tasks/Darwin/neovim.yml b/tasks/Darwin/neovim.yml new file mode 100644 index 0000000..9b3bc59 --- /dev/null +++ b/tasks/Darwin/neovim.yml @@ -0,0 +1,8 @@ +--- +- name: append neovim to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'neovim' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/nerdfonts.yml b/tasks/Darwin/nerdfonts.yml new file mode 100644 index 0000000..e2d4745 --- /dev/null +++ b/tasks/Darwin/nerdfonts.yml @@ -0,0 +1,16 @@ +--- +- name: MacOS Tap homebrew fonts + community.general.homebrew_tap: + name: homebrew/cask-fonts + state: present + +- name: generate nerdfont cask names + loop: "{{ nerdfonts }}" + loop_control: + loop_var: font + set_fact: + nerdfont_casks: "{{ (nerdfont_casks | default([])) + [ 'homebrew/cask/font-' + font.brew + '-nerd-font' ] }}" + +- name: append nerdfonts to caskpkgs + set_fact: + caskpkgs: "{{ (caskpkgs | default([])) + nerdfont_casks }}" diff --git a/tasks/Darwin/nodejs.yml b/tasks/Darwin/nodejs.yml new file mode 100644 index 0000000..9076057 --- /dev/null +++ b/tasks/Darwin/nodejs.yml @@ -0,0 +1,8 @@ +--- +- name: append node to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'node' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/nushell.yml b/tasks/Darwin/nushell.yml new file mode 100644 index 0000000..d331d51 --- /dev/null +++ b/tasks/Darwin/nushell.yml @@ -0,0 +1,9 @@ +--- +- name: append nushell to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'nushell' ]}}" + tags: + - MacOS + - homebrew + - package + - shell diff --git a/tasks/Darwin/pandoc.yml b/tasks/Darwin/pandoc.yml new file mode 100644 index 0000000..fb9639d --- /dev/null +++ b/tasks/Darwin/pandoc.yml @@ -0,0 +1,8 @@ +--- +- name: append pandoc to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'pandoc' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/pipx.yml b/tasks/Darwin/pipx.yml new file mode 100644 index 0000000..aba00a3 --- /dev/null +++ b/tasks/Darwin/pipx.yml @@ -0,0 +1,8 @@ +--- +- name: append pipx to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'pipx' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/python3-pip.yml b/tasks/Darwin/python3-pip.yml new file mode 100644 index 0000000..7304434 --- /dev/null +++ b/tasks/Darwin/python3-pip.yml @@ -0,0 +1,8 @@ +--- +- name: append python3 to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'python3' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/ripgrep.yml b/tasks/Darwin/ripgrep.yml new file mode 100644 index 0000000..218123a --- /dev/null +++ b/tasks/Darwin/ripgrep.yml @@ -0,0 +1,8 @@ +--- +- name: append ripgrep to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'ripgrep' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/rust.yml b/tasks/Darwin/rust.yml new file mode 100644 index 0000000..b00ce16 --- /dev/null +++ b/tasks/Darwin/rust.yml @@ -0,0 +1,8 @@ +--- +- name: append rust to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'rust' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/stow.yml b/tasks/Darwin/stow.yml new file mode 100644 index 0000000..3e9cda3 --- /dev/null +++ b/tasks/Darwin/stow.yml @@ -0,0 +1,8 @@ +--- +- name: append stow to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'stow' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/terminal.yml b/tasks/Darwin/terminal.yml new file mode 100644 index 0000000..5972493 --- /dev/null +++ b/tasks/Darwin/terminal.yml @@ -0,0 +1,11 @@ +--- +# default on Linux is alacritty +# edit config/users.yml:users::terminal:os_name:package name +# ie: config/users.yml:users:[name: stobbsm]:terminal:Fedora:konsole +- name: install and configure system terminal emulator + loop: "{{ users }}" + ansible.builtin.include_tasks: + file: "packages/{{ ansible_os_family }}/{{ item.terminal[ansible_distribution] | default('alacritty') }}.yml" + tags: + - package + - Darwin diff --git a/tasks/Darwin/terraform.yml b/tasks/Darwin/terraform.yml new file mode 100644 index 0000000..efd94fc --- /dev/null +++ b/tasks/Darwin/terraform.yml @@ -0,0 +1,4 @@ +--- +- name: append terraform to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'terraform' ]}}" diff --git a/tasks/Darwin/tidy.yml b/tasks/Darwin/tidy.yml new file mode 100644 index 0000000..aed7359 --- /dev/null +++ b/tasks/Darwin/tidy.yml @@ -0,0 +1,8 @@ +--- +- name: append tidy-html5 to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'tidy-html5' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/tmux.yml b/tasks/Darwin/tmux.yml new file mode 100644 index 0000000..ccc766c --- /dev/null +++ b/tasks/Darwin/tmux.yml @@ -0,0 +1,8 @@ +--- +- name: append tmux to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'tmux' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/vivaldi.yml b/tasks/Darwin/vivaldi.yml new file mode 100644 index 0000000..834142b --- /dev/null +++ b/tasks/Darwin/vivaldi.yml @@ -0,0 +1,4 @@ +--- +- name: append vivaldi to caskpkgs + set_fact: + caskpkgs: "{{ (caskpkgs | default([])) + [ 'vivaldi' ] }}" diff --git a/tasks/Darwin/zoxide.yml b/tasks/Darwin/zoxide.yml new file mode 100644 index 0000000..df5ee0b --- /dev/null +++ b/tasks/Darwin/zoxide.yml @@ -0,0 +1,8 @@ +--- +- name: append zoxide to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'zoxide' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin/zsh.yml b/tasks/Darwin/zsh.yml new file mode 100644 index 0000000..12196f0 --- /dev/null +++ b/tasks/Darwin/zsh.yml @@ -0,0 +1,8 @@ +--- +- name: append zsh to brewpkgs + set_fact: + brewpkgs: "{{ (brewpkgs | default([])) + [ 'zsh' ]}}" + tags: + - MacOS + - homebrew + - package diff --git a/tasks/Darwin_do_install.yml b/tasks/Darwin_do_install.yml new file mode 100644 index 0000000..95a1ec8 --- /dev/null +++ b/tasks/Darwin_do_install.yml @@ -0,0 +1,45 @@ +--- +- name: full homebrew upgrade if enabled + community.general.homebrew: + update_homebrew: true + upgrade_all: true + when: full_upgrade + tags: + - upgrade + - packages + - Darwin + - macOS + - homebrew + +- name: full cask upgrade if enabled + community.general.homebrew_cask: + upgrade_all: true + when: full_upgrade + tags: + - upgrade + - packages + - Darwin + - macOS + - homebrew + - homebrew_cask + +- name: install homebrew pkgs + community.general.homebrew: + name: "{{ syspkgs | unique }}" + state: "{{ install_state }}" + tags: + - packages + - Darwin + - macOS + - homebrew + +- name: install homebrew casks + community.general.homebrew_cask: + name: "{{ (caskpkgs | default([])) | unique }}" + state: "{{ install_state }}" + tags: + - packages + - Darwin + - macOS + - homebrew + - homebrew_cask diff --git a/tasks/Debian/alacritty.yml b/tasks/Debian/alacritty.yml new file mode 100644 index 0000000..777b26f --- /dev/null +++ b/tasks/Debian/alacritty.yml @@ -0,0 +1,26 @@ +--- +- name: install rust and cargo + ansible.builtin.include_tasks: + file: "packages/{{ ansible_os_family }}/rust.yml" + tags: + - rust + - dependency + +- name: install alacritty dependencies for Debian based distributions + become: true + ansible.builtin.apt: + name: + - cmake + - pkg-config + - libfreetype6-dev + - libfontconfig1-dev + - libxcb-xfixes0-dev + - libxkbcommon-dev + - python3 + state: present + tags: + - dependency + - Debian + +- include_tasks: + file: packages/Linux/alacritty.yml diff --git a/tasks/Debian/ansible.yml b/tasks/Debian/ansible.yml new file mode 100644 index 0000000..405940f --- /dev/null +++ b/tasks/Debian/ansible.yml @@ -0,0 +1,14 @@ +--- +- name: install ansible for Debian based distros + become: true + ansible.builtin.apt: + name: ansible + state: latest + register: ansible_changed + tags: + - Debian + - linux + - package +- name: stop playbook if ansible updated + when: ansible_changed.changed + meta: end_play diff --git a/tasks/Debian/btop.yml b/tasks/Debian/btop.yml new file mode 100644 index 0000000..905e1bc --- /dev/null +++ b/tasks/Debian/btop.yml @@ -0,0 +1,11 @@ +--- +- name: install btop for Debian distros + become: true + when: ansible_os_family == "Debian" + ansible.builtin.apt: + name: btop + state: latest + tags: + - Debian + - linux + - package diff --git a/tasks/Debian/cmake.yml b/tasks/Debian/cmake.yml new file mode 100644 index 0000000..62ab4bc --- /dev/null +++ b/tasks/Debian/cmake.yml @@ -0,0 +1,10 @@ +--- +- name: Install cmake for Debian based distros + become: true + ansible.builtin.apt: + name: cmake + state: latest + tags: + - Debian + - linux + - package diff --git a/tasks/Debian/editorconfig.yml b/tasks/Debian/editorconfig.yml new file mode 100644 index 0000000..515c9be --- /dev/null +++ b/tasks/Debian/editorconfig.yml @@ -0,0 +1,11 @@ +--- +- name: Install editorconfig Debian based distros + become: true + ansible.builtin.apt: + name: editorconfig + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/firefox.yml b/tasks/Debian/firefox.yml new file mode 100644 index 0000000..990d88a --- /dev/null +++ b/tasks/Debian/firefox.yml @@ -0,0 +1,9 @@ +--- +- name: install firefox on Linux distros + ansible.builtin.apt: + name: firefox + state: latest + tags: + - packages + - Debian + - web diff --git a/tasks/Debian/fzf.yml b/tasks/Debian/fzf.yml new file mode 100644 index 0000000..8693622 --- /dev/null +++ b/tasks/Debian/fzf.yml @@ -0,0 +1,10 @@ +--- +- name: Install fzf for Debian based distros + become: true + ansible.builtin.apt: + name: fzf + state: latest + tags: + - Debian + - linux + - package diff --git a/tasks/Debian/git.yml b/tasks/Debian/git.yml new file mode 100644 index 0000000..20f0a9c --- /dev/null +++ b/tasks/Debian/git.yml @@ -0,0 +1,15 @@ +--- +- name: Install git and git extras for Debian based distros + become: true + ansible.builtin.apt: + name: + - git + - git-delta + - git-email + - git-lfs + + state: latest + tags: + - Debian + - linux + - package diff --git a/tasks/Debian/go.yml b/tasks/Debian/go.yml new file mode 100644 index 0000000..9363a7a --- /dev/null +++ b/tasks/Debian/go.yml @@ -0,0 +1,4 @@ +--- +- name: install go for linux + ansible.builtin.include_tasks: + file: "packages/Linux/go.yml" diff --git a/tasks/Debian/hugo.yml b/tasks/Debian/hugo.yml new file mode 100644 index 0000000..6fe005e --- /dev/null +++ b/tasks/Debian/hugo.yml @@ -0,0 +1,11 @@ +--- +- name: Install hugo for Debian based distros + become: true + ansible.builtin.apt: + name: hugo + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/jq.yml b/tasks/Debian/jq.yml new file mode 100644 index 0000000..4ec0070 --- /dev/null +++ b/tasks/Debian/jq.yml @@ -0,0 +1,11 @@ +--- +- name: Install jq for Debian based distros + become: true + ansible.builtin.apt: + name: jq + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/neovide.yml b/tasks/Debian/neovide.yml new file mode 100644 index 0000000..cb91219 --- /dev/null +++ b/tasks/Debian/neovide.yml @@ -0,0 +1,29 @@ +--- +- name: install debian dependencies + when: ansible_architecture != "aarch64" + become: true + ansible.builtin.apt: + name: + - curl + - gnupg + - ca-certificates + - git + - gcc-multilib + - g++-multilib + - cmake + - libssl-dev + - pkg-config + - libfreetyp6-dev + - libasound2-dev + - libexpat1-dev + - libxcb-composite0-dev + - libbz2-dev + - libsndio-dev + - freeglut3-dev + - libxmu-dev + - libxi-dev + - libfontconfig1-dev + - libxcursor-dev + +- ansible.builtin.include_tasks: + file: packages/Linux/neovide.yml diff --git a/tasks/Debian/neovim.yml b/tasks/Debian/neovim.yml new file mode 100644 index 0000000..2753c85 --- /dev/null +++ b/tasks/Debian/neovim.yml @@ -0,0 +1,12 @@ +--- +- name: Install neovim for Debian based distros + become: true + ansible.builtin.apt: + name: + - neovim + - python3-neovim + state: latest + tags: + - Debian + - linux + - package diff --git a/tasks/Debian/nerdfonts.yml b/tasks/Debian/nerdfonts.yml new file mode 100644 index 0000000..75eb9ac --- /dev/null +++ b/tasks/Debian/nerdfonts.yml @@ -0,0 +1,3 @@ +--- +- ansible.builtin.include_tasks: + file: packages/Linux/nerdfonts.yml diff --git a/tasks/Debian/nodejs.yml b/tasks/Debian/nodejs.yml new file mode 100644 index 0000000..9d1a7b1 --- /dev/null +++ b/tasks/Debian/nodejs.yml @@ -0,0 +1,13 @@ +--- +- name: Install nodejs and npm for Debian based distros + become: true + ansible.builtin.apt: + name: + - nodejs + - npm + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/nushell.yml b/tasks/Debian/nushell.yml new file mode 100644 index 0000000..bed09de --- /dev/null +++ b/tasks/Debian/nushell.yml @@ -0,0 +1,11 @@ +--- +- name: install Debian dependencies + become: true + ansible.builtin.apt: + name: + - pkg-config + - libssl-dev + - build-essential + +- ansible.builtin.include_tasks: + file: packages/Linux/nushell.yml diff --git a/tasks/Debian/pandoc.yml b/tasks/Debian/pandoc.yml new file mode 100644 index 0000000..a269abc --- /dev/null +++ b/tasks/Debian/pandoc.yml @@ -0,0 +1,11 @@ +--- +- name: Install pandoc for Debian based distros + become: true + ansible.builtin.apt: + name: pandoc + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/pipx.yml b/tasks/Debian/pipx.yml new file mode 100644 index 0000000..ca912f1 --- /dev/null +++ b/tasks/Debian/pipx.yml @@ -0,0 +1,11 @@ +--- +- name: Install pipx for Debian based distros + become: true + ansible.builtin.apt: + name: pipx + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/python3-pip.yml b/tasks/Debian/python3-pip.yml new file mode 100644 index 0000000..4052904 --- /dev/null +++ b/tasks/Debian/python3-pip.yml @@ -0,0 +1,11 @@ +--- +- name: Install pip for Debian based distros + become: true + ansible.builtin.apt: + name: python3-pip + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/ripgrep.yml b/tasks/Debian/ripgrep.yml new file mode 100644 index 0000000..53f8e7e --- /dev/null +++ b/tasks/Debian/ripgrep.yml @@ -0,0 +1,11 @@ +--- +- name: Install ripgrep for Debian based distros + become: true + ansible.builtin.apt: + name: ripgrep + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/rust.yml b/tasks/Debian/rust.yml new file mode 100644 index 0000000..cf41afa --- /dev/null +++ b/tasks/Debian/rust.yml @@ -0,0 +1,13 @@ +--- +- name: Install rust and cargo for Debian based distros + become: true + ansible.builtin.apt: + name: + - rustc + - cargo + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/stow.yml b/tasks/Debian/stow.yml new file mode 100644 index 0000000..de71c7f --- /dev/null +++ b/tasks/Debian/stow.yml @@ -0,0 +1,11 @@ +--- +- name: Install stow for Debian based distros + become: true + ansible.builtin.apt: + name: stow + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/terminal.yml b/tasks/Debian/terminal.yml new file mode 100644 index 0000000..60c70a8 --- /dev/null +++ b/tasks/Debian/terminal.yml @@ -0,0 +1,11 @@ +--- +# default on Linux is alacritty +# edit config/users.yml:users::terminal:os_name:package name +# ie: config/users.yml:users:[name: stobbsm]:terminal:Fedora:konsole +- name: install and configure system terminal emulator + loop: "{{ users }}" + ansible.builtin.include_tasks: + file: "packages/{{ ansible_os_family }}/{{ item.terminal[ansible_distribution] | default('alacritty') }}.yml" + tags: + - package + - Debian diff --git a/tasks/Debian/tidy.yml b/tasks/Debian/tidy.yml new file mode 100644 index 0000000..c2df76c --- /dev/null +++ b/tasks/Debian/tidy.yml @@ -0,0 +1,11 @@ +--- +- name: Install tidy for Debian based distros + become: true + ansible.builtin.apt: + name: tidy + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/tmux.yml b/tasks/Debian/tmux.yml new file mode 100644 index 0000000..3181e0a --- /dev/null +++ b/tasks/Debian/tmux.yml @@ -0,0 +1,11 @@ +--- +- name: Install tmux for Debian based distros + become: true + ansible.builtin.apt: + name: tmux + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/vivaldi.yml b/tasks/Debian/vivaldi.yml new file mode 100644 index 0000000..174dbc2 --- /dev/null +++ b/tasks/Debian/vivaldi.yml @@ -0,0 +1,6 @@ +--- +- name: install vivaldi debian package + become: true + ansible.builtin.apt: + deb: https://downloads.vivaldi.com/stable/vivaldi-stable_6.7.3329.41-1_amd64.deb + state: present diff --git a/tasks/Debian/zoxide.yml b/tasks/Debian/zoxide.yml new file mode 100644 index 0000000..31650be --- /dev/null +++ b/tasks/Debian/zoxide.yml @@ -0,0 +1,11 @@ +--- +- name: Install zoxide for Debian based distros + become: true + ansible.builtin.apt: + name: zoxide + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Debian/zsh.yml b/tasks/Debian/zsh.yml new file mode 100644 index 0000000..80fc8eb --- /dev/null +++ b/tasks/Debian/zsh.yml @@ -0,0 +1,11 @@ +--- +- name: Install zsh for Debian based distros + become: true + ansible.builtin.apt: + name: zsh + state: latest + tags: + - Debian + - linux + - package + diff --git a/tasks/Linux/alacritty.yml b/tasks/Linux/alacritty.yml new file mode 100644 index 0000000..13042ce --- /dev/null +++ b/tasks/Linux/alacritty.yml @@ -0,0 +1,13 @@ +--- +- name: build and install alacritty + become: true + ansible.builtin.command: + cmd: + - cargo + - install + - --root + - /usr/local + - --git + - https://github.com/alacritty/alacritty.git + - --tag + - v0.13.2 diff --git a/tasks/Linux/files/neovide/icon.png b/tasks/Linux/files/neovide/icon.png new file mode 100644 index 0000000..3f6da54 Binary files /dev/null and b/tasks/Linux/files/neovide/icon.png differ diff --git a/tasks/Linux/files/neovide/neovide.desktop b/tasks/Linux/files/neovide/neovide.desktop new file mode 100644 index 0000000..f0da33a --- /dev/null +++ b/tasks/Linux/files/neovide/neovide.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Exec=/usr/local/bin/neovide +Name=Neovide +Icon=/usr/share/icons/neovide.png diff --git a/tasks/Linux/gitea.yml b/tasks/Linux/gitea.yml new file mode 100644 index 0000000..9aca480 --- /dev/null +++ b/tasks/Linux/gitea.yml @@ -0,0 +1,128 @@ +--- +- name: ensure gitea user exists + become: true + ansible.builtin.user: + comment: gitea user + home: /var/lib/gitea + create_home: false + group: git + name: git + state: present + system: true + +- name: install gitea binary + become: true + ansible.builtin.get_url: + backup: true + checksum: "sha256:https://dl.gitea.com/gitea/1.22.2/gitea-1.22.2-linux-amd64.sha256" + decompress: false + dest: /usr/local/bin/gitea + mode: '755' + url: https://dl.gitea.com/gitea/1.22.2/gitea-1.22.2-linux-amd64 + state: present + +- name: ensure gitea paths exist + become: true + ansible.builtin.file: + group: git + owner: git + mode: '750' + path: '{{ item }}' + state: directory + loop: + - /var/lib/gitea + - /var/lib/gitea/custom + - /var/lib/gitea/data + - /var/lib/gitea/log + +- name: ensure gitea configuration directory exists + become: true + ansible.builtin.file: + group: git + owner: root + mode: '750' + path: /etc/gitea + state: directory + +- name: install gitea configuration + become: true + ansible.builtin.template: + backup: true + group: git + owner: root + mode: '640' + dest: /etc/gitea/app.ini + src: gitea/app.ini.j2 + vars: + # global settings + app_name: 'Gitea: Git with a cup of tea' + run_mode: prod + workpath: /var/lib/gitea + # repository settings + repository_default_branch: main + repository_disable_http_git: false + repository_enable_push_create_user: true + # server settings + server_allow_graceful_restarts: true + server_app_data_path: '' + server_domain: git.staur.ca + server_enable_gzip: true + server_enable_pprof: false + server_graceful_hammer_time: 1m0s + server_http_addr: 0.0.0.0 + server_landing_page: home + server_lfs_jwt_secret: dvyUMJ81VjfO_PuHJt_4W-b6S58-yU2oMfF0N8KqzNg + server_lfs_start_server: true + server_local_use_proxy: false + server_minimum_key_size_check: true + server_offline_mode: false + server_per_write_kb_timeout: 10s + server_per_write_timeout: 30s + server_port: 3000 + server_protocol: http + server_proxy_protocol_accept_unknown: false + server_proxy_protocol_tls_bridging: false + server_redirector_use_proxy_protocol: false + server_ssh_domain: gitea.applications.staur.ca + server_ssh_listen_port: 22 + server_ssh_port: 22 + server_startup_timeout: 0s + server_static_cache_time: 1h0m0s + server_static_root_path: /data + server_use_proxy_protocol: false + sever_proxy_protocol_header_timeout: 5s + # database settings + database_host: postgres01.applications.staur.ca + database_log_sql: false + database_name: gitea + database_passwd: gitea + database_ssl_mode: disable + database_type: postgres + database_user: gitea + # session settings + session_cookie_name: gitea_session + session_cookie_secure: true + session_provider: db + session_provider_config: /sessions + # security settings + security_secret_key: L2tOg455yeumJDDUEdw1ma69ckdoKP1UMgVZ9bXJZkCKkhCjfQmngYXDllUzdTKG + security_internal_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2OTM2MjA3NDh9.NCqR3b7ZHTwTcGky9FtSEii4ams2rG3Y06Iqvorc65Y + # service settings + service_disable_registration: true + service_require_signin_view: false + service_enable_captcha: false + service_register_email_confirm: true + service_no_reply_address: noreply+git@stobbs.ca + service_default_keep_email_private: true + service_default_enable_timetracking: true + service_allow_only_external_registration: false + service_allow_enable_notify_mail: false + service_default_allow_create_oranization: true + # lfs minio settings + lfs_minio_access_key_id: jvafijdsllesb5cuoj2s7eqe7zpq + lfs_minio_bucket: git-lfs-stobbs-ca + lfs_minio_endpoint: gateway.storjshare.io + lfs_minio_location: ca-central-1 + lfs_minio_secret_access_key: jzl5ehrxpklz37cdafetar2ihcdldgfadpv5g5udsih7ujf6s2lq6 + mailer_passwd: + mailer_protocol: diff --git a/tasks/Linux/go.yml b/tasks/Linux/go.yml new file mode 100644 index 0000000..b49520c --- /dev/null +++ b/tasks/Linux/go.yml @@ -0,0 +1,41 @@ +--- +- name: Set go Filename + ansible.builtin.set_fact: + goFilename: "go{{ go.version }}.linux-{{ arch[ansible_architecture] }}.{{ go.linux.extension }}" + tags: + - dev + - go + - debug + +- name: Download latest go package for linux + become: true + ansible.builtin.get_url: + dest: "/tmp/{{ goFilename }}" + url: "https://go.dev/dl/{{ goFilename }}" + checksum: "sha256:{{ go.linux.sum[ansible_architecture] }}" + decompress: false + tags: + - dev + - go + +- name: Ensure go install dir exists + become: true + ansible.builtin.file: + path: /usr/local + state: directory + +- name: Extract go package for Linux + become: true + ansible.builtin.unarchive: + dest: /usr/local + src: "/tmp/{{ goFilename }}" + remote_src: true + +- name: Cleanup go package download + become: true + ansible.builtin.file: + path: "/tmp/{{ goFilename }}" + state: absent + tags: + - dev + - go diff --git a/tasks/Linux/neovide.yml b/tasks/Linux/neovide.yml new file mode 100644 index 0000000..d58767d --- /dev/null +++ b/tasks/Linux/neovide.yml @@ -0,0 +1,17 @@ +--- +- name: Build and install neovide + become: true + ansible.builtin.command: + cmd: cargo install --root /usr/local --git https://github.com/neovide/neovide + +- name: Copy neovide icon + become: true + ansible.builtin.copy: + src: neovide/icon.png + dest: /usr/share/icons/neovide.png + +- name: Copy neovide.desktop + become: true + ansible.builtin.copy: + src: neovide/neovide.desktop + dest: /usr/local/share/applications/neovide.desktop diff --git a/tasks/Linux/nerdfonts.yml b/tasks/Linux/nerdfonts.yml new file mode 100644 index 0000000..be54f96 --- /dev/null +++ b/tasks/Linux/nerdfonts.yml @@ -0,0 +1,22 @@ +# Install nerdfonts for each platform +--- +- name: Create nerdfonts directories + loop: "{{ nerdfonts }}" + loop_control: + loop_var: font + ansible.builtin.file: + path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.local/share/fonts/{{ font.name }}" + state: directory + register: nerdfont_result + +- name: Download and extract nerdfonts + when: nerdfont_result is changed + loop: "{{ nerdfonts }}" + loop_control: + loop_var: font + ansible.builtin.unarchive: + creates: "{{ lookup('ansible.builtin.env', 'HOME') }}/.local/share/fonts/{{ font.name }}/README.md" + src: "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/{{ font.name }}.tar.xz" + dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/.local/share/fonts/{{ font.name }}" + remote_src: true + diff --git a/tasks/Linux/nushell.yml b/tasks/Linux/nushell.yml new file mode 100644 index 0000000..05498fe --- /dev/null +++ b/tasks/Linux/nushell.yml @@ -0,0 +1,21 @@ +--- +- name: install nushell via cargo + become: true + ansible.builtin.command: + cmd: "cargo install --root /usr/local {{ nuitem }} --locked" + loop_control: + loop_var: nuitem + loop: + - nu + - nu_plugin_inc + - nu_plugin_polars + - nu_plugin_gstat + - nu_plugin_formats + - nu_plugin_query + - nu_plugin_highlight + - nu_plugin_json_path + - nu_plugin_net + - nu_plugin_prometheus + - nu_plugin_qr_maker + - nu_plugin_rpm + - nu_plugin_semver diff --git a/tasks/RedHat/alacritty.yml b/tasks/RedHat/alacritty.yml new file mode 100644 index 0000000..bdef7c7 --- /dev/null +++ b/tasks/RedHat/alacritty.yml @@ -0,0 +1,25 @@ +--- +- name: install rust and cargo + ansible.builtin.include_tasks: + file: "packages/{{ ansible_os_family }}/rust.yml" + tags: + - rust + - dependency + +- name: set alacritty pkg deps + set_fact: + alacritty_deps: + - cmake + - freetype-devel + - fontconfig-devel + - libxcb-devel + - libxkbcommon-devel + - g++ + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + alacritty_deps }}" + altpkgs: "{{ (altpkgs | default([])) + [ 'packages/Linux/alacritty.yml' ] }}" + tags: + - syspkgs + - altpkgs diff --git a/tasks/RedHat/ansible.yml b/tasks/RedHat/ansible.yml new file mode 100644 index 0000000..80be3b7 --- /dev/null +++ b/tasks/RedHat/ansible.yml @@ -0,0 +1,7 @@ +# Install ansible for current platform +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'ansible' ] }}" + diff --git a/tasks/RedHat/btop.yml b/tasks/RedHat/btop.yml new file mode 100644 index 0000000..ce57fc8 --- /dev/null +++ b/tasks/RedHat/btop.yml @@ -0,0 +1,5 @@ +--- +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'btop' ] }}" + diff --git a/tasks/RedHat/carapace.yml b/tasks/RedHat/carapace.yml new file mode 100644 index 0000000..37d85fa --- /dev/null +++ b/tasks/RedHat/carapace.yml @@ -0,0 +1,7 @@ +--- +- name: install carapace RPM + become: true + ansible.builtin.dnf: + name: https://github.com/carapace-sh/carapace-bin/releases/download/v1.0.7/carapace-bin_1.0.7_linux_amd64.rpm + state: present + disable_gpg_check: true diff --git a/tasks/RedHat/cmake.yml b/tasks/RedHat/cmake.yml new file mode 100644 index 0000000..b652ac3 --- /dev/null +++ b/tasks/RedHat/cmake.yml @@ -0,0 +1,9 @@ +--- +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'cmake' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/consul.yml b/tasks/RedHat/consul.yml new file mode 100644 index 0000000..8a9285c --- /dev/null +++ b/tasks/RedHat/consul.yml @@ -0,0 +1,9 @@ +--- +- name: ensure hashicorp repo is active + ansible.builtin.include_tasks: + file: packages/{{ ansible_os_family }}/hashicorp_repo.yml + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'consul' ] }}" + diff --git a/tasks/RedHat/editorconfig.yml b/tasks/RedHat/editorconfig.yml new file mode 100644 index 0000000..1da3333 --- /dev/null +++ b/tasks/RedHat/editorconfig.yml @@ -0,0 +1,8 @@ +--- +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'editorconfig' ] }}" + tags: + - RedHat + - linux + - package diff --git a/tasks/RedHat/firefox.yml b/tasks/RedHat/firefox.yml new file mode 100644 index 0000000..7716398 --- /dev/null +++ b/tasks/RedHat/firefox.yml @@ -0,0 +1,9 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'firefox' ] }}" + tags: + - packages + - RedHat + - web diff --git a/tasks/RedHat/fzf.yml b/tasks/RedHat/fzf.yml new file mode 100644 index 0000000..421766a --- /dev/null +++ b/tasks/RedHat/fzf.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'fzf' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/ghostty.yml b/tasks/RedHat/ghostty.yml new file mode 100644 index 0000000..845b481 --- /dev/null +++ b/tasks/RedHat/ghostty.yml @@ -0,0 +1,15 @@ +--- +- name: ensure dependencies + ansible.builtin.include_tasks: + file: packages/RedHat/terra_repo.yml + tags: + - dependency + - package + - terra + - syspkgs + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'ghostty' ] }}" + tags: + - syspkgs diff --git a/tasks/RedHat/git.yml b/tasks/RedHat/git.yml new file mode 100644 index 0000000..564a07c --- /dev/null +++ b/tasks/RedHat/git.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'git', 'git-delta', 'git-email', 'git-lfs' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/go.yml b/tasks/RedHat/go.yml new file mode 100644 index 0000000..24d0866 --- /dev/null +++ b/tasks/RedHat/go.yml @@ -0,0 +1,5 @@ +--- + +- name: append to pkgs + set_fact: + altpkgs: "{{ (altpkgs | default([])) + [ 'packages/Linux/go.yml' ] }}" diff --git a/tasks/RedHat/hashicorp_repo.yml b/tasks/RedHat/hashicorp_repo.yml new file mode 100644 index 0000000..611369a --- /dev/null +++ b/tasks/RedHat/hashicorp_repo.yml @@ -0,0 +1,27 @@ +# install hashicorp vault for RedHat +--- +- name: enable hashicorp repo for fedora >=41 + become: true + when: + - ansible_distribution == 'Fedora' + - ansible_distribution_major_version|int >= 41 + ansible.builtin.command: + creates: /etc/yum.repos.d/hashicorp.repo + cmd: dnf config-manager addrepo --from-repofile=https://rpm.releases.hashicorp.com/fedora/hashicorp.repo + +- name: enable hashicorp repo for fedora <41 + become: true + when: + - ansible_distribution == 'Fedora' + - ansible_distribution_major_version|int < 41 + ansible.builtin.command: + creates: /etc/yum.repos.d/hashicorp.repo + cmd: dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo + +- name: enable hashicorp repo for RHEL like distribution + become: true + when: + - ansible_distribution != 'Fedora' + ansible.builtin.command: + creates: /etc/yum.repos.d/hashicorp.repo + cmd: dnf config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo diff --git a/tasks/RedHat/hugo.yml b/tasks/RedHat/hugo.yml new file mode 100644 index 0000000..c36e354 --- /dev/null +++ b/tasks/RedHat/hugo.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'hugo' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/jq.yml b/tasks/RedHat/jq.yml new file mode 100644 index 0000000..e7ef2e9 --- /dev/null +++ b/tasks/RedHat/jq.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'jq' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/konsole.yml b/tasks/RedHat/konsole.yml new file mode 100644 index 0000000..92f5269 --- /dev/null +++ b/tasks/RedHat/konsole.yml @@ -0,0 +1,9 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'konsole' ] }}" + tags: + - RedHat + - linux + - package diff --git a/tasks/RedHat/neovide.yml b/tasks/RedHat/neovide.yml new file mode 100644 index 0000000..b4337d9 --- /dev/null +++ b/tasks/RedHat/neovide.yml @@ -0,0 +1,19 @@ +--- +- name: set neovide pkg dependencies + set_fact: + neovide_deps: + - cargo + - fontconfig-devel + - freetype-devel + - libX11-xcb + - libX11-devel + - libstdc++-static + - libstdc++-devel + - "@Development Tools" + - "@Development Libraries" + +- name: append to pkgs + when: ansible_architecture != "aarch64" + set_fact: + syspkgs: "{{ (syspkgs | default([])) + neovide_deps }}" + altpkgs: "{{ (altpkgs | default([])) + [ 'packages/Linux/neovide.yml' ] }}" diff --git a/tasks/RedHat/neovim.yml b/tasks/RedHat/neovim.yml new file mode 100644 index 0000000..ae932dd --- /dev/null +++ b/tasks/RedHat/neovim.yml @@ -0,0 +1,22 @@ +--- +- name: append to pkgs + when: ansible_distribution == "Fedora" + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'neovim', 'python3-neovim' ] }}" + tags: + - RedHat + - linux + - package + +- name: Install neovim appimage + when: ansible_distribution != "Fedora" + become: true + ansible.builtin.get_url: + url: https://github.com/neovim/neovim/releases/download/v0.10.0/nvim.appimage + dest: /usr/local/bin/nvim + checksum: sha256:6a021e9465fe3d3375e28c3e94c1c2c4f7d1a5a67e4a78cf52d18d77b1471390 + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/nerdfonts.yml b/tasks/RedHat/nerdfonts.yml new file mode 100644 index 0000000..2d60161 --- /dev/null +++ b/tasks/RedHat/nerdfonts.yml @@ -0,0 +1,4 @@ +--- +- name: append to pkgs + set_fact: + altpkgs: "{{ (altpkgs | default([])) + [ 'packages/Linux/nerdfonts.yml' ] }}" diff --git a/tasks/RedHat/nodejs.yml b/tasks/RedHat/nodejs.yml new file mode 100644 index 0000000..da4b6d9 --- /dev/null +++ b/tasks/RedHat/nodejs.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'nodejs', 'npm' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/nomad.yml b/tasks/RedHat/nomad.yml new file mode 100644 index 0000000..750fa19 --- /dev/null +++ b/tasks/RedHat/nomad.yml @@ -0,0 +1,9 @@ +--- +- name: ensure hashicorp repo is active + ansible.builtin.include_tasks: + file: packages/{{ ansible_os_family }}/hashicorp_repo.yml + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'nomad' ] }}" + diff --git a/tasks/RedHat/nushell.yml b/tasks/RedHat/nushell.yml new file mode 100644 index 0000000..927d084 --- /dev/null +++ b/tasks/RedHat/nushell.yml @@ -0,0 +1,16 @@ +--- +- name: install RedHat dependencies + set_fact: + nushell_pkgdeps: + - cargo + - libxcb + - openssl-devel + - libX11-devel + nushell_altdeps: + - packages/Linux/nushell.yml + - packages/{{ ansible_os_family }}/carapace.yml + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + nushell_pkgdeps }}" + altpkgs: "{{ (altpkgs | default([])) + nushell_altdeps }}" diff --git a/tasks/RedHat/packer.yml b/tasks/RedHat/packer.yml new file mode 100644 index 0000000..70f3fa4 --- /dev/null +++ b/tasks/RedHat/packer.yml @@ -0,0 +1,8 @@ +--- +- name: ensure hashicorp repo is active + ansible.builtin.include_tasks: + file: packages/{{ ansible_os_family }}/hashicorp_repo.yml + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'packer' ] }}" diff --git a/tasks/RedHat/pandoc.yml b/tasks/RedHat/pandoc.yml new file mode 100644 index 0000000..5fadb3b --- /dev/null +++ b/tasks/RedHat/pandoc.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'pandoc' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/pipx.yml b/tasks/RedHat/pipx.yml new file mode 100644 index 0000000..ff6ef40 --- /dev/null +++ b/tasks/RedHat/pipx.yml @@ -0,0 +1,9 @@ +--- +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'pipx' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/python3-pip.yml b/tasks/RedHat/python3-pip.yml new file mode 100644 index 0000000..5b0664f --- /dev/null +++ b/tasks/RedHat/python3-pip.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'python3-pip' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/ripgrep.yml b/tasks/RedHat/ripgrep.yml new file mode 100644 index 0000000..ecd6c26 --- /dev/null +++ b/tasks/RedHat/ripgrep.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'ripgrep' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/rust.yml b/tasks/RedHat/rust.yml new file mode 100644 index 0000000..df1cc4f --- /dev/null +++ b/tasks/RedHat/rust.yml @@ -0,0 +1,14 @@ +--- +- name: set rust_pkgs + set_fact: + rust_pkgs: + - rustc + - cargo +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + rust_pkgs }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/stow.yml b/tasks/RedHat/stow.yml new file mode 100644 index 0000000..f731135 --- /dev/null +++ b/tasks/RedHat/stow.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'stow' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/terminal.yml b/tasks/RedHat/terminal.yml new file mode 100644 index 0000000..a24c243 --- /dev/null +++ b/tasks/RedHat/terminal.yml @@ -0,0 +1,12 @@ +--- + +# default on Linux is alacritty +# edit config/users.yml:users::terminal:os_name:package name +# ie: config/users.yml:users:[name: stobbsm]:terminal:Fedora:konsole +- name: install and configure system terminal emulator + loop: "{{ users }}" + ansible.builtin.include_tasks: + file: "packages/{{ ansible_os_family }}/{{ item.terminal[ansible_distribution] | default('alacritty') }}.yml" + tags: + - package + - RedHat diff --git a/tasks/RedHat/terra_repo.yml b/tasks/RedHat/terra_repo.yml new file mode 100644 index 0000000..8c5ef62 --- /dev/null +++ b/tasks/RedHat/terra_repo.yml @@ -0,0 +1,22 @@ +--- +- name: enable terra repo for fedora >=41 + become: true + when: + - ansible_distribution == 'Fedora' + - ansible_distribution_major_version|int >= 41 + ansible.builtin.command: + creates: /etc/yum.repos.d/terra.repo + cmd: dnf install -y --nogpgcheck --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' terra-release + +- name: enable terra repo for fedora <41 + when: + - ansible_distribution == 'Fedora' + - ansible_distribution_major_version|int < 41 + block: + - ansible.builtin.command: + creates: /etc/yum.repos.d/terra.repo + cmd: dnf config-manager --add-repo https://terra.fyralabs.com/terra.repo + become: true + - ansible.builtin.dnf: + name: terra-release + state: present diff --git a/tasks/RedHat/terraform.yml b/tasks/RedHat/terraform.yml new file mode 100644 index 0000000..7ecd657 --- /dev/null +++ b/tasks/RedHat/terraform.yml @@ -0,0 +1,8 @@ +--- +- name: ensure hashicorp repo is active + ansible.builtin.include_tasks: + file: packages/{{ ansible_os_family }}/hashicorp_repo.yml + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'terraform' ] }}" diff --git a/tasks/RedHat/tidy.yml b/tasks/RedHat/tidy.yml new file mode 100644 index 0000000..d223079 --- /dev/null +++ b/tasks/RedHat/tidy.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'tidy' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/tmux.yml b/tasks/RedHat/tmux.yml new file mode 100644 index 0000000..b574459 --- /dev/null +++ b/tasks/RedHat/tmux.yml @@ -0,0 +1,10 @@ +--- + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'tmux' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat/vault.yml b/tasks/RedHat/vault.yml new file mode 100644 index 0000000..d68eb60 --- /dev/null +++ b/tasks/RedHat/vault.yml @@ -0,0 +1,9 @@ +# install hashicorp vault for RedHat +--- +- name: ensure hashicorp repo is active + ansible.builtin.include_tasks: + file: packages/{{ ansible_os_family }}/hashicorp_repo.yml + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'vault' ] }}" diff --git a/tasks/RedHat/vivaldi.yml b/tasks/RedHat/vivaldi.yml new file mode 100644 index 0000000..3dc071f --- /dev/null +++ b/tasks/RedHat/vivaldi.yml @@ -0,0 +1,14 @@ +--- +- name: Configure RPM Repository + become: true + ansible.builtin.yum_repository: + name: vivaldi + baseurl: "https://repo.vivaldi.com/archive/rpm/{{ ansible_architecture }}" + description: vivaldi browser + gpgcheck: true + gpgkey: https://repo.vivaldi.com/archive/linux_signing_key.pub + state: present + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'vivaldi-stable' ] }}" diff --git a/tasks/RedHat/zfs.yml b/tasks/RedHat/zfs.yml new file mode 100644 index 0000000..8f30d1d --- /dev/null +++ b/tasks/RedHat/zfs.yml @@ -0,0 +1,65 @@ +--- +- name: set rpm_dist + ansible.builtin.command: rpm --eval "%{dist}" + register: rpm_dist + tags: + - packages + - RedHat + - config + +- name: set zfs repo facts + set_fact: + zfs_repo_base: https://zfsonlinux.org + zfs_gpg_key: https://raw.githubusercontent.com/zfsonlinux/zfsonlinux.github.com/master/zfs-release/RPM-GPG-KEY-openzfs-key2 + zfs_gpg_key_fingerprint: 7DC7 299D CF7C 7FD9 CD87 701B A599 FD5E 9DB8 4141 + +- name: el9+ specific configuration + block: + - name: set el9+ facts + set_fact: + rh_release: epel + zfs_release: 2-3 + when: + - ansible_distribution != 'Fedora' + # TODO: figure out a better way to identify EPEL based distros + # TODO: Alma, rocky, centos, rhel + tags: + - packages + - RedHat + - config + +- name: Fedora specific configuration + block: + - name: set fedora facts + set_fact: + rh_release: fedora + zfs_release: 2-6 + when: ansible_distribution == 'Fedora' + when: ansible_distribution == 'Fedora' + +- name: add openzfs gpg_key + ansible.builtin.rpm_key: + key: "{{ zfs_gpg_key }}" + fingerprint: "{{ zfs_gpg_key_fingerprint }}" + state: present + become: true + tags: + - packages + - RedHat + +- name: enable openzfs repository + ansible.builtin.dnf: + name: "{{ zfs_repo_base }}{{ rh_release }}/zfs-release-{{ zfs_release }}{{ rpm_dist.stdout }}.noarch.rpm" + state: "{{ install_state }}" + become: true + tags: + - packages + - RedHat + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'zfs' ] }}" + become: true + tags: + - RedHat + - packages diff --git a/tasks/RedHat/zoxide.yml b/tasks/RedHat/zoxide.yml new file mode 100644 index 0000000..53dec2e --- /dev/null +++ b/tasks/RedHat/zoxide.yml @@ -0,0 +1,17 @@ +--- +- name: Enable copr repo for zoxide + become: true + when: ansible_distribution != "Fedora" + community.general.copr: + name: atim/zoxide + state: enabled + chroot: "{{ coprChroot[ansible_distribution].chroot | default(omit) }}" + +- name: append to pkgs + set_fact: + syspkgs: "{{ (syspkgs | default([])) + [ 'zoxide' ] }}" + tags: + - RedHat + - linux + - package + diff --git a/tasks/RedHat_do_install.yml b/tasks/RedHat_do_install.yml new file mode 100644 index 0000000..9e23e78 --- /dev/null +++ b/tasks/RedHat_do_install.yml @@ -0,0 +1,33 @@ +--- +- name: full system upgrade if enabled + ansible.builtin.dnf: + name: "*" + state: latest + when: full_upgrade + become: true + tags: + - upgrade + - packages + - asroot + - RedHat + +- name: install packages from system package manager + ansible.builtin.dnf: + name: "{{ syspkgs | unique }}" + state: "{{ install_state }}" + when: syspkgs|length > 0 + become: true + tags: + - packages + - asroot + - os + +- name: install packages from outside system + ansible.builtin.include_tasks: + file: "{{ altpkg }}" + loop: "{{ altpkgs }}" + loop_control: + loop_var: altpkg + tags: + - packages + - altinstall diff --git a/tasks/main.yml b/tasks/main.yml index c57cca9..c3047c9 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,16 @@ --- -- name: set list of packages to install - set_fact: - packages: "{{ (packages | default([])) + (common_packages | default([])) }}" +- name: generate package manager installation list + ansible.builtin.include_tasks: + file: "{{ ansible_os_family }}/{{ pkg }}.yml" + loop: "{{ packages }}" + loop_control: + loop_var: pkg + tags: + - config + - packages + +- name: install system package list + ansible.builtin.include_tasks: + file: "{{ ansible_os_family }}_do_install.yml" + tags: + - packages diff --git a/vars/main.yml b/vars/main.yml index e746906..851d821 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,7 @@ # variables used in ansible_role_package --- packages: [] +syspkgs: [] +altpkgs: [] +install_state: present +full_upgrade: false