Skip to content

Commit

Permalink
feat: support RedHad-based systems and latest Ansible versions
Browse files Browse the repository at this point in the history
Fixes #8, #10
  • Loading branch information
markosamuli committed Feb 17, 2023
1 parent ee4fc3e commit 666a634
Show file tree
Hide file tree
Showing 35 changed files with 785 additions and 337 deletions.
4 changes: 3 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
---
exclude_paths:
- .travis.yml
- .travis.yml
- .ansible-lint
32 changes: 13 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,45 @@
# -*- mode: yaml -*-
# vim:ts=2:sw=2:ai:si:syntax=yaml
################################
# pre-commit hooks configuration
################################
---

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v2.2.3
rev: v4.4.0
hooks:
- id: check-executables-have-shebangs
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: trailing-whitespace
args: ['--markdown-linebreak-ext=md']
args: ["--markdown-linebreak-ext=md"]
- id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=lf']
args: ["--fix=lf"]
- id: check-yaml
- id: pretty-format-json
args: ['--autofix', '--indent=2', '--no-sort-keys']
args: ["--autofix", "--indent=2", "--no-sort-keys"]

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.16.0
rev: v1.29.0
hooks:
- id: yamllint

- repo: https://github.com/ansible/ansible-lint.git
rev: v4.1.0
rev: v6.13.1
hooks:
- id: ansible-lint
files: \.(yaml|yml)$

- repo: https://github.com/bemeurer/beautysh.git
rev: '4.1'
- repo: https://github.com/syntaqx/git-hooks
rev: v0.0.17
hooks:
- id: beautysh
- id: shellcheck
files: (tests/run-.*|tests/update)$

- repo: https://github.com/openstack-dev/bashate.git
rev: '0.6.0'
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.6.0-1
hooks:
- id: bashate
- id: shfmt
files: (tests/run-.*|tests/update)$

- repo: https://github.com/igorshubovych/markdownlint-cli.git
rev: v0.17.0
rev: v0.33.0
hooks:
- id: markdownlint
51 changes: 42 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,77 @@
# Changelog

## [2.0.0] - 2023-02-17

### Ansible compatibility

- Require Ansible 2.9.22
- Support Ansible 7.2.0
- Use fully qualified collection names (FQCN) with builtin modules

### Fixes

- Use `become_user` instead of `become` when installing with Git by [@Hunsu] in [#6]
- Remove installer script checksum that causes issues [#10]

[@hunsu]: https://github.com/Hunsu
[#6]: https://github.com/markosamuli/ansible-linuxbrew/pull/6
[#10]: https://github.com/markosamuli/ansible-linuxbrew/issues/10

### Python compatibility

- Use Python 3 on all test Docker images
- Drop support for EOL Python 2.7

### OS compatibility

- Add support for Ubuntu 20.04 LTS and 22.04 LTS
- Add support for Debian 11
- Add support for Fedora 37 and RedHat based-systems by [@aarey] in [#9]
- Drop support for Debian 11
- Drop support for Ubuntu 16.04 LTS

[@aarey]: https://github.com/aairey
[#9]: https://github.com/markosamuli/ansible-linuxbrew/pull/9

## [1.2.2] - 2020-09-06

### Fixed

* Update `install.sh` checksum
* Create missing `var/homebrew/linked` directory
* Update `linuxbrew-core` repository URL
- Update `install.sh` checksum
- Create missing `var/homebrew/linked` directory
- Update `linuxbrew-core` repository URL

## [1.2.1] - 2020-09-05

### Fixed

* Migrate to the new `install.sh` script
- Migrate to the new `install.sh` script

## [1.2.0] - 2019-10-25

### Changes

* Add `linuxbrew_init_shell` variable to allow shell file modification to be
- Add `linuxbrew_init_shell` variable to allow shell file modification to be
disabled. Fixes [#1]

## [1.1.1] - 2019-07-20

### Fixes

* Updated `install.sh` checksum for the 2019-07-18 updated version.
- Updated `install.sh` checksum for the 2019-07-18 updated version.

## [1.1.0] - 2019-07-14

### Changes

* Use Ansible tasks to clone the Homebrew Git repositories, create directories
- Use Ansible tasks to clone the Homebrew Git repositories, create directories
and set permissions where possible instead of using the official installer
bash script.

### Fixes

* Install installation dependencies.
* Update both `.bashrc` and `.zshrc` shell scripts.
- Install installation dependencies.
- Update both `.bashrc` and `.zshrc` shell scripts.

## [1.0.0] - 2019-01-13

Expand Down
31 changes: 26 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
PRE_COMMIT_HOOKS=.git/hooks/pre-commit

.DEFAULT_GOAL := help

# Use VERBOSE=1 make <command> to get verbose output
ifndef VERBOSE
.SILENT:
endif

.PHONY: help
help: ## print this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort -d | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

PRE_COMMIT_HOOKS = .git/hooks/pre-commit

TEST_IMAGES = $(shell ls tests/*/Dockerfile | xargs dirname | xargs basename)

.PHONY: setup
setup: $(PRE_COMMIT_HOOKS)

.PHONY: test
test:
@./tests/run-tests
test: ## run tests with all available Docker images
./tests/run-tests

.PHONY: $(TEST_IMAGES)
$(TEST_IMAGES):
./tests/run-tests $@

.PHONY: lint
lint: $(PRE_COMMIT_HOOKS)
@pre-commit run -a
pre-commit run -a

$(PRE_COMMIT_HOOKS):
@pre-commit install
pre-commit install
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ using Travis CI on my OSS projects.

I've tested the role up to Ansible 2.8 using local installation.

## Compatibility

Run tests with a supported Docker image, for example with `bionic`:

```bash
make bionic
```

| Release | Docker image | Ansible |
| ---------------- | ---------------------- | ---------------- |
| Ubuntu 18.04 LTS | [`bionic`][bionic] | `<2.12,>=2.9.22` |
| Ubuntu 20.04 LTS | [`focal`][focal] | `>=2.9.22` |
| Ubuntu 22.04 LTS | [`jammy`][jammy] | `>=2.9.22` |
| Debian 10 | [`buster`][buster] | `<2.12,>=2.9.22` |
| Debian 11 | [`bullseye`][bullseye] | `>=2.9.22` |
| Fedora 37 | [`fedora37`][fedora37] | `>=2.9.22` |

[bionic]: tests/bionic/Dockerfile
[focal]: tests/focal/Dockerfile
[jammy]: tests/jammy/Dockerfile
[buster]: tests/buster/Dockerfile
[bullseye]: tests/buster/Dockerfile
[fedora37]: tests/fedora37/Dockerfile

## Configuration

By default, the role uses Ansible to clone the Homebrew Git repository and
Expand All @@ -26,10 +50,12 @@ you need to enable this in the Ansible configuration:
linuxbrew_use_installer: true
```
The installer seems to be faster than the default Ansible installation method.
## Role Variables
Set `linuxbrew_init_shell` to `false` if you're for example managing your shell
rc files using your own .dotfiles repository.
init files using your own `.dotfiles` repository.

```yaml
# Configure shell rc files
Expand Down
1 change: 0 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

# Path to user home directory
linuxbrew_home: "{{ ansible_env.HOME }}"

Expand Down
16 changes: 10 additions & 6 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# -*- mode: yaml -*-
# vim:ts=2:sw=2:ai:si:syntax=yaml
---

galaxy_info:
role_name: linuxbrew
namespace: markosamuli
author: Marko Samuli Kirves
description: Install Linuxbrew
license: MIT
min_ansible_version: 2.6
description: Install Homebrew on Linux
license: BSD
min_ansible_version: 2.9.22
github_branch: master
platforms:
- name: Ubuntu
versions:
- xenial
- bionic
- focal
- jammy
- name: Debian
versions:
- buster
- stretch
- bullseye
- name: Fedora
versions:
- "37"
galaxy_tags:
- linuxbrew
- homebrew
Expand Down
13 changes: 0 additions & 13 deletions tasks/install.yml

This file was deleted.

3 changes: 1 addition & 2 deletions tasks/install_debian.yml → tasks/install/debian.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

- name: Install dependencies with APT
apt:
ansible.builtin.apt:
name: "{{ linuxbrew_install_dependencies }}"
when: linuxbrew_install_dependencies is defined
become: true
16 changes: 16 additions & 0 deletions tasks/install/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Install dependencies on Debian based systems
ansible.builtin.include_tasks: debian.yml
when: "ansible_os_family == 'Debian' or ansible_distribution == 'Pengwin'"

- name: Install dependencies on RedHat based systems
ansible.builtin.include_tasks: redhat.yml
when: "ansible_os_family == 'RedHat'"

- name: Install with Git
ansible.builtin.include_tasks: with_git.yml
when: not linuxbrew_use_installer

- name: Install using the installer script
ansible.builtin.include_tasks: with_installer.yml
when: linuxbrew_use_installer
7 changes: 7 additions & 0 deletions tasks/install/redhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Install dependencies with yum
ansible.builtin.yum:
name: "{{ linuxbrew_install_dependencies }}"
state: present
when: linuxbrew_install_dependencies is defined
become: true
Loading

0 comments on commit 666a634

Please sign in to comment.