Skip to content

Commit

Permalink
Add new default packages
Browse files Browse the repository at this point in the history
  • Loading branch information
staticdev committed Jun 27, 2023
1 parent 92329c8 commit 1661f6d
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
run: pip3 install --constraint=.github/workflows/constraints.txt ansible 'molecule-plugins[podman]' podman

- name: Run Molecule tests
run: molecule test
run: molecule -vv test
env:
PY_COLORS: "1"
ANSIBLE_FORCE_COLOR: "1"
Expand Down
82 changes: 50 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,69 @@ Note: this is an opinionated setup I personally use for software development. Yo

<a name="overriding-defaults">

### Overriding Defaults
### Included Applications / Configuration (Default)

Packages (installed with apt):

```yaml
- apache2-utils
- cmake
- dconf-editor # visual gnome configs
- gir1.2-clutter-1.0 # dep gnome extension system monitor
- gir1.2-clutter-gst-3.0 # dep gnome extension system monitor
- gir1.2-gtkclutter-1.0 # dep gnome extension system monitor
- locales-all
- openssl
- poedit
```
It also installs with [Nix] package manager:
</a>
```yaml
- git
- kubectl
- helm
- k9s
- htop
- libvirt
- nmap
- podman
- qemu
- thefuck
- tmux
- vagrant
- virtualbox
- vim
- wget
- xclip
```
Finally, there are a few other preferences and settings added on for various apps and services.
### Overriding Defaults
Not everyone's workstation and preferred software configuration is the same.
You can override any of the defaults configured in **default.config.yml** by creating a **config.yml** file and setting the overrides in that file. For example, you can customize the installed packages and apps with something like:
You can override any of the defaults configured in **default.config.yml** by creating a **config.yml** file and setting the overrides in that file. For example, you can customize the installed packages (apt) with:
```yaml
installed_packages:
- git
- go
```
For [Nix] packages, it is necessary to specify a command that will verify if it is already installed, most binaries support `--version` or just `version`, eg:

```yaml
nix_packages:
- name: git
check_cmd: git --version
- name: kubectl
check_cmd: kubectl version --client
```

Other package managers:

```yaml
snap_packages:
- name: code
classic: true
Expand Down Expand Up @@ -117,34 +163,6 @@ Edit the **inventory** file in this repository and change the line that starts w

If you need to supply an SSH password (if you don't use SSH keys), make sure to pass the **--ask-pass** parameter to the **ansible-playbook** command.

### Included Applications / Configuration (Default)

Packages (installed with apt):

```yaml
- apache2-utils
- cmake
- dconf-editor # visual gnome configs
- gir1.2-clutter-1.0 # dep gnome extension system monitor
- gir1.2-clutter-gst-3.0 # dep gnome extension system monitor
- gir1.2-gtkclutter-1.0 # dep gnome extension system monitor
- git
- htop
- locales-all
- nmap
- openssl
- podman
- poedit
- thefuck
- tmux
- vagrant
- vim
- xclip
- wget
```

Finally, there are a few other preferences and settings added on for various apps and services.

## Contributing

Contributions are very welcome.
Expand Down
1 change: 1 addition & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Vagrant.configure("2") do |config|
# Run playbook
config.vm.provision "ansible" do |ansible|
ansible.playbook = "main.yml"
ansible.verbose = "vv"
end
end
end
41 changes: 30 additions & 11 deletions default.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pyenv_virtualenvs: []
# IDEs
## Pycharm
install_pycharm: false
pycharm_flavor: community # you can also choose: professional or edu
pycharm_flavor: community # you can also choose: professional
## VSCodium (community-driven, freely-licensed binary distribution of Microsoft’s editor VSCode)
install_vscodium: true

Expand Down Expand Up @@ -119,24 +119,43 @@ installed_packages:
- gir1.2-clutter-1.0 # dep gnome extension system monitor
- gir1.2-clutter-gst-3.0 # dep gnome extension system monitor
- gir1.2-gtkclutter-1.0 # dep gnome extension system monitor
- git
- htop
- locales-all
- nmap
- openssl
- podman
- poedit
- thefuck
- tmux
- vagrant
- vim
- xclip
- wget

# install packages from other package managers.
install_extra_packages: true
# Note: You are responsible for adding the required package managers
# installation, eg. through nix
nix_packages:
- name: git
check_cmd: git --version
- name: kubectl
check_cmd: kubectl version --client
- name: helm
check_cmd: helm --version
- name: k9s
check_cmd: k9s --version
- name: htop
check_cmd: htop --version
- name: nmap
check_cmd: nmap --version
- name: podman
check_cmd: podman --version
- name: thefuck
check_cmd: thefuck --version
- name: tmux
check_cmd: tmux -V
- name: vagrant
check_cmd: vagrant --version
- name: vim
check_cmd: vim --version
- name: virtualbox
check_cmd: which virtualbox
- name: wget
check_cmd: wget --version
- name: xclip
check_cmd: xclip -version
snap_packages: []
# - name: postman
gem_packages: []
Expand Down
2 changes: 1 addition & 1 deletion main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
when: install_zsh

- name: Office setup
ansible.builtin.include_tasks: tasks/office.yml
ansible.builtin.include_tasks: tasks/office.yml
when: install_onlyoffice or remove_libreoffice

- name: Install packages
Expand Down
2 changes: 1 addition & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ roles:

collections:
- name: community.general
version: 7.0.1
version: 7.1.0
- name: community.crypto
version: 2.14.0
5 changes: 3 additions & 2 deletions tasks/extra-packages.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: "Check if nix package {{ item.name }} is installed"
- name: "Check installation of nix package {{ item.name }}"
ansible.builtin.command: "{{ item.check_cmd }}"
register: package_check_cmd
changed_when: false
Expand All @@ -8,9 +8,10 @@
loop_control:
index_var: package_index

- name: "Install {{ item.name }} with nix"
- name: "Install nix package {{ item.name }}"
ansible.builtin.command: "nix-env -iA nixpkgs.{{ item.name }}"
when: package_check_cmd.results[package_index].failed
changed_when: true
loop: "{{ nix_packages }}"
loop_control:
index_var: package_index
Expand Down
3 changes: 2 additions & 1 deletion tasks/keypass-xc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Check if Keepass XC is installed
- name: Check installation of Keepass XC
ansible.builtin.command: keepassxc --version
register: keepass_xc_cmd
changed_when: false
Expand All @@ -8,3 +8,4 @@
when: keepass_xc_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.keepassxc
changed_when: true
19 changes: 10 additions & 9 deletions tasks/office.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
- name: OnlyOffice
when: install_onlyoffice
block:
- name: Check if OnlyOffice is installed
ansible.builtin.command: onlyoffice-desktopeditors --version
register: onlyoffice_version_cmd
changed_when: false
ignore_errors: true
- name: Install OnlyOffice
when: onlyoffice_version_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.onlyoffice-bin
- name: Check installation of OnlyOffice
ansible.builtin.command: onlyoffice-desktopeditors --version
register: onlyoffice_version_cmd
changed_when: false
ignore_errors: true
- name: Install OnlyOffice
when: onlyoffice_version_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.onlyoffice-bin
changed_when: true

- name: Remove LibreOffice
ansible.builtin.package:
Expand Down
42 changes: 22 additions & 20 deletions tasks/pycharm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@
- name: Pycharm professional
when: pycharm_flavor == 'professional'
block:
- name: Check if Pycharm professional is installed
ansible.builtin.command: pycharm-professional --version
register: pycharm_version_cmd
changed_when: false
ignore_errors: true
- name: Install Pycharm professional
when: pycharm_version_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.jetbrains.pycharm-professional --impure
environment:
NIXPKGS_ALLOW_UNFREE: 1
- name: Check installation of Pycharm professional
ansible.builtin.command: pycharm-professional --version
register: pycharm_version_cmd
changed_when: false
ignore_errors: true
- name: Install Pycharm professional
when: pycharm_version_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.jetbrains.pycharm-professional --impure
environment:
NIXPKGS_ALLOW_UNFREE: "1"
changed_when: true

- name: Pycharm community
when: pycharm_flavor == 'community'
block:
- name: Check if Pycharm community is installed
ansible.builtin.command: pycharm-community --version
register: pycharm_version_cmd
changed_when: false
ignore_errors: true
- name: Install Pycharm community
when: pycharm_version_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.jetbrains.pycharm-community
- name: Check installation of Pycharm community
ansible.builtin.command: pycharm-community --version
register: pycharm_version_cmd
changed_when: false
ignore_errors: true
- name: Install Pycharm community
when: pycharm_version_cmd is failed
ansible.builtin.command:
cmd: nix-env -iA nixpkgs.jetbrains.pycharm-community
changed_when: true
2 changes: 1 addition & 1 deletion tasks/validate-config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Validate PyCharm flavor
fail:
ansible.builtin.fail:
msg: "Unsupported PyCharm flavor '{{ pycharm_flavor }}'. Allowed values are 'community' and 'professional'."
when: install_pycharm and pycharm_flavor not in ['community', 'professional']

0 comments on commit 1661f6d

Please sign in to comment.