1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_ranger.git synced 2024-08-16 14:19:48 +02:00

Cleanup ranger install

+ adding block/rescue
+ improve lint
+ actions
+ docs
+ meta
This commit is contained in:
L3D 2023-10-29 15:09:27 +01:00
parent ad75843636
commit fd2a5afebb
No known key found for this signature in database
GPG key ID: AD65B920933B4B20
30 changed files with 131 additions and 461 deletions

View file

@ -1,18 +0,0 @@
---
name: Ansible check alpine:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with alpine:latest'
uses: roles-ansible/check-ansible-alpine-latest-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check archlinux:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with archlinux:latest'
uses: roles-ansible/check-ansible-archlinux-latest-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check centos:centos7
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with ubuntu:centos7'
uses: roles-ansible/check-ansible-centos-centos7-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check centos:centos8
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with ubuntu:centos8'
uses: roles-ansible/check-ansible-centos-centos8-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check centos:stream9
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with quay.io/centos/centos:stream9'
uses: roles-ansible/check-ansible-centos-centos9-action@main
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check centos:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with ubuntu:latest'
uses: roles-ansible/check-ansible-centos-latest-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check debian:bullseye
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with debian:bullseye'
uses: roles-ansible/check-ansible-debian-bullseye-action@main
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check debian:buster
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with debian:buster'
uses: roles-ansible/check-ansible-debian-buster-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check debian:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with debian:latest'
uses: roles-ansible/check-ansible-debian-latest-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check debian:sid
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with debian:sid'
uses: roles-ansible/check-ansible-debian-sid-action@master
with:
targets: "./"

View file

@ -1,23 +0,0 @@
---
name: Ansible check debian:stable
# yamllint disable-line rule:truthy
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with debian:stable'
uses: roles-ansible/check-ansible-debian-stable-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check debian:stretch
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with debian:stretch'
uses: roles-ansible/check-ansible-debian-stretch-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check fedora:31
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with fedora:31'
uses: roles-ansible/check-ansible-fedora-31-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check fedora:32
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with fedora:32'
uses: roles-ansible/check-ansible-fedora-32-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check fedora:33
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with fedora:33'
uses: roles-ansible/check-ansible-fedora-33-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check fedora:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with fedora:latest'
uses: roles-ansible/check-ansible-fedora-latest-action@master
with:
targets: "./"

View file

@ -2,21 +2,21 @@
name: Ansible Lint check
# yamllint disable-line rule:truthy
on:
push:
branches: '*'
pull_request:
branches: '*'
on: [push, pull_request]
jobs:
build:
name: Ansible Lint
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'Lint Ansible Playbook'
uses: ansible/ansible-lint-action@v6
- name: Checkout git repo
uses: actions/checkout@v4
with:
targets: "."
submodules: true
fetch-depth: 0
- name: Run ansible-lint
uses: ansible-actions/ansible-lint-action@v1.0.2
with:
target: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check ubuntu:bionic
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'ansible check with ubuntu:bionic'
uses: roles-ansible/check-ansible-ubuntu-bionic-action@master
with:
targets: "./"

View file

@ -1,18 +0,0 @@
---
name: Ansible check ubuntu:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: ansible check with ubuntu:latest
uses: roles-ansible/check-ansible-ubuntu-latest-action@master
with:
targets: "./"

View file

@ -1,22 +1,24 @@
---
name: Galaxy release
name: Galaxy-NG Roles Import
# yamllint disable-line rule:truthy
on:
push:
branches: ['main']
release:
types: ['created']
jobs:
build:
name: Galaxy Role Importer
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'release on galaxy'
uses: robertdebock/galaxy-action@1.2.0
steps:
- name: 'Checkout git repo'
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: 'Release on galaxy'
uses: ansible-actions/ansible-galaxy-action@v1.1.1
with:
galaxy_api_key: ${{ secrets.galaxy_api_key }}
git_branch: 'main'

22
.github/workflows/j2lint-check.yml vendored Normal file
View file

@ -0,0 +1,22 @@
---
name: Jinja2 Linting check
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
name: Jinja2 Linting
runs-on: ubuntu-latest
steps:
- name: Checkout git repo
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Run j2lint
uses: ansible-actions/j2lint-action@v0.0.1
with:
target: "./"

22
.github/workflows/yamllint-check.yml vendored Normal file
View file

@ -0,0 +1,22 @@
---
name: Yamllint check
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
name: Yamllint
runs-on: ubuntu-latest
steps:
- name: Checkout git repo
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Run yamllint
uses: ansible-actions/yamllint-action@v0.0.1
with:
target: "./"

View file

@ -1,23 +0,0 @@
---
name: 'Yamllint GitHub Actions'
# yamllint disable-line rule:truthy
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
yamllint:
name: 'Yamllint'
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'Yamllint'
uses: karancode/yamllint-github-action@v2.0.0
with:
yamllint_file_or_dir: '.'
yamllint_config_filepath: './.yamllint'

View file

@ -1,6 +1,5 @@
[![Ansible Galaxy](https://raw.githubusercontent.com/roles-ansible/ansible_role_ranger/master/.github/galaxy.svg?sanitize=true)](https://galaxy.ansible.com/do1jlr/ranger) [![MIT License](https://raw.githubusercontent.com/roles-ansible/ansible_role_ranger/master/.github/license.svg?sanitize=true)](https://github.com/roles-ansible/ansible_role_ranger/blob/master/LICENSE)
ansible_role_ranger
==============
@ -19,7 +18,6 @@ Ansible role to install the ranger file manager on linux. ranger is a console fi
You can either use this role via ansible galaxy or use it directly from [this](https://github.com/roles-ansible/ansible_role_ranger.git) git repository.
### ansible galaxy
install role:
```bash
ansible-galaxy install do1jlr.ranger
@ -39,9 +37,7 @@ Example Ansible-Playbook:
- do1jlr.ranger
```
### use via git command
clone github repo:
```bash
git clone https://github.com/roles-ansible/ansible_role_ranger.git
@ -59,39 +55,12 @@ example Playbook:
submodules_versioncheck: true
```
## Testing
This role is tested with [these github-action](https://github.com/search?q=topic%3Acheck-ansible+topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories) tests for different versions of differen linux systems.
If you want to find out more about our tests, please have a look at the github marketplace.
| test status | Github Marketplace |
| :--------- | :---------------- |
| [![Galaxy release](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/galaxy.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/galaxy.yml) | [publish-ansible-role-to-galaxy](https://github.com/marketplace/actions/publish-ansible-role-to-galaxy) |
| [![Yamllint GitHub Actions](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/yamllint.yaml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/yamllint.yaml) | [yamllint-github-action](https://github.com/marketplace/actions/yamllint-github-action) |
| [![Ansible Lint check](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-linting-check.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-linting-check.yml) | [ansible-lint action](https://github.com/marketplace/actions/ansible-lint)
| [![Ansible check debian:latest](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-debian-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-debian-latest.yml) | [ansible test with debian stable](https://github.com/marketplace/actions/check-ansible-debian-stable) |
| [![Ansible check debian:latest](https://github.com/roles-ansible/ansible_role_ranger/workflows/Ansible%20check%20debian:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions?query=workflow%3A%22Ansible+check+debian%3Alatest%22) | [ansible test with debian latest](https://github.com/marketplace/actions/check-ansible-debian-latest) |
| [![Ansible check debian:sid](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-debian-sid.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-debian-sid.yml) | [ansible test with debian sid](https://github.com/marketplace/actions/check-ansible-debian-sid) |
| [![Ansible check debian:stable](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-debian-stable.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-debian-stable.yml) | [ansible test with debian stable](https://github.com/marketplace/actions/check-ansible-debian-stable) |
| [![Ansible check debian:buster](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-debian-buster.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-debian-buster.yml) | [ansible test with debian buster](https://github.com/marketplace/actions/check-ansible-debian-buster) |
| | |
| [![Ansible check archlinux:latest](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-archlinux-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-archlinux-latest.yml) | [ansible test with archlinux latest](https://github.com/marketplace/actions/check-ansible-archlinux-latest) |
| | |
| [![Ansible check ubuntu:latest](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-ubuntu-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-ubuntu-latest.yml) | [ansible test with ubuntu latest](https://github.com/marketplace/actions/check-ansible-ubuntu-latest) |
| [![Ansible check ubuntu:bionic](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-ubuntu-bionic.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-ubuntu-bionic.yml) | [ansible test with ubuntu bionic](https://github.com/marketplace/actions/check-ansible-ubuntu-bionic) |
| [![Ansible check ubuntu:trusty](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-ubuntu-trusty.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-ubuntu-trusty.yml) | [ansible test with ubuntu trusty](https://github.com/marketplace/actions/check-ansible-ubuntu-trusty) |
| | |
| [![Ansible check fedora:latest](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-fedora-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-fedora-latest.yml) | [ansible test with fedora latest](https://github.com/marketplace/actions/check-ansible-fedora-latest) |
| [![Ansible check fedora:33](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-fedora-33.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-fedora-33.yml) | [ansible test with fedora 33](https://github.com/marketplace/actions/check-ansible-fedora-33) |
| [![Ansible check fedora:32](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-fedora-32.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-fedora-32.yml) | [ansible test with fedora 32](https://github.com/marketplace/actions/check-ansible-fedora-32) |
| [![Ansible check fedora:31](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-fedora-31.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-fedora-31.yml) | [ansible test with fedora 31](https://github.com/marketplace/actions/check-ansible-fedora-31) |
| | |
| [![Ansible check centos:latest](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-centos-latest.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-centos-latest.yml) | [ansible test with centos latest](https://github.com/marketplace/actions/check-ansible-centos-latest) |
| [![Ansible check centos:centos8](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-centos-centos8.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-centos-centos8.yml) | [ansible test with centos centos8](https://github.com/marketplace/actions/check-ansible-centos-centos8) |
| [![Ansible check centos:centos7](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-centos-centos7.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions/workflows/ansible-centos-centos7.yml) | [ansible test with centos centos7](https://github.com/marketplace/actions/check-ansible-centos-centos7) |
| | |
| [![Ansible check alpine:latest](https://github.com/roles-ansible/ansible_role_ranger/workflows/Ansible%20check%20alpine:latest/badge.svg)](https://github.com/roles-ansible/ansible_role_ranger/actions?query=workflow%3A%22Ansible+check+alpine%3Alatest%22) | [ansible test with alpine latest](https://github.com/marketplace/actions/check-ansible-alpine-latest) |
## Requirements
The ``community.general`` collection is required for some parts of this ansible role.
You can install it with this command:
```bash
ansible-galaxy collection install -r requirements.yml --upgrade
```
variables
-------

View file

@ -3,23 +3,25 @@ galaxy_info:
author: do1jlr
description: Ansible role to install the ranger file manager on linux. ranger is a console file manager with VI key bindings.
role_name: ranger
namespace: l3d
license: MIT
min_ansible_version: 2.8
min_ansible_version: '2.13'
github_branch: main
platforms:
- name: Archlinux
versions: all
- name: ArchLinux
versions: ['all']
- name: Debian
versions: all
versions: ['all']
- name: Ubuntu
versions: all
versions: ['all']
- name: Fedora
versions: all
versions: ['all']
- name: EL
versions: all
versions: ['all']
galaxy_tags:
- ranger
- filemanager
- cli
- console
- linux
dependencies: []

4
requirements.yml Normal file
View file

@ -0,0 +1,4 @@
---
collections:
- name: 'community.general'
version: ">=7.5.0,<=8.0.0"

View file

@ -1,32 +1,31 @@
---
- name: download ranger git repo
- name: Download ranger git repo
ansible.builtin.git:
repo: "{{ ranger.repo }}"
dest: "{{ ranger.download_directory }}"
version: "{{ ranger.branch }}"
- name: install build packages
- name: Install build packages
become: true
ansible.builtin.package:
name: "{{ ranger__build_deps }}"
state: present
state: 'present'
- name: Run 'install' target as root
- name: Run 'install' target as root # noqa: H1901
become: true
community.general.make:
chdir: "{{ ranger.download_directory }}"
target: install
target: 'install'
when: ansible_python_version[:1] == '3'
- name: install python3
- name: Install python3
become: true
ansible.builtin.package:
name: python3
state: present
name: 'python3'
state: 'present'
register: install_python3
ignore_errors: true
- name: install ranger with python3
- name: Install ranger with python3
become: true
ansible.builtin.command: python3 setup.py install --optimize=1
args:
@ -34,16 +33,17 @@
creates: '/usr/local/bin/ranger'
when: not install_python3.failed
- name: install legacy-python f00
- name: Install legacy-python f00
become: true
ansible.builtin.package:
name:
- python
- python-setuptools
state: present
name: "{{ item }}"
state: 'present'
loop:
- 'python'
- 'python-setuptools'
when: install_python3.failed
- name: install ranger with legacy-python
- name: Install ranger with legacy-python
become: true
ansible.builtin.command: python setup.py install --optimize=1
args:

View file

@ -1,10 +1,11 @@
---
- name: combine ranger configuration
- name: Combine ranger configuration
ansible.builtin.set_fact:
ranger: "{{ _ranger | combine(ranger, recursive=True) }}"
- name: run optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml
- name: Run optional versionscheck
ansible.builtin.include_tasks:
file: 'versioncheck.yml'
when: submodules_versioncheck|bool
- name: Update apt cache
@ -14,14 +15,14 @@
update_cache: true
when: ansible_pkg_mgr == "apt"
- name: install ranger
- name: Install ranger
block:
- name: Install ranger
become: true
ansible.builtin.package:
name: ranger
state: present
register: install_ranger
ignore_errors: true
- name: compile ranger if install failed
ansible.builtin.include_tasks: compile_ranger.yml
when: install_ranger.failed
rescue:
- name: Compile ranger if regular install failed
ansible.builtin.include_tasks:
file: 'compile_ranger.yml'

View file

@ -7,24 +7,23 @@
ansible.builtin.file:
path: '/etc/.ansible-version'
state: directory
mode: 0755
mode: '0755'
when: submodules_versioncheck | bool
- name: check playbook version
- name: Check playbook version
become: true
ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version
when: submodules_versioncheck | bool
ignore_errors: true
failed_when: false
- name: Print remote role version
- name: Print remote role version # noqa: H500
ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
when: submodules_versioncheck | bool
- name: Print locale role version
- name: Print locale role version # noqa: H500
ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number | string }}'."
when: submodules_versioncheck | bool
@ -35,10 +34,11 @@
when:
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck | bool
- name: write new version to remote disk
- name: Write new version to remote disk
become: true
ansible.builtin.copy:
content: "{{ playbook_version_number }}"
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
mode: '0644'
when: submodules_versioncheck | bool
tags: skip_ansible_lint_template-instead-of-copy

View file

@ -1,6 +1,6 @@
---
# versionscheck
playbook_version_number: 1028 # should be int
playbook_version_number: 1029 # should be int
playbook_version_path: 'role-ranger_roles-ansible_github.com.version'
# variables for ranger