1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_dotfiles.git synced 2024-08-16 16:09:49 +02:00

Cleanup role, lint and actions

This commit is contained in:
L3D 2023-10-31 00:34:06 +01:00
parent 5cd1afc650
commit 38f6d73c73
No known key found for this signature in database
GPG key ID: AD65B920933B4B20
33 changed files with 121 additions and 425 deletions

9
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,9 @@
---
# See https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

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 name: Ansible Lint check
# yamllint disable-line rule:truthy # yamllint disable-line rule:truthy
on: on: [push, pull_request]
push:
branches: '*'
pull_request:
branches: '*'
jobs: jobs:
build: build:
name: Ansible Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 'checkout git repo' - name: Checkout git repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: 'Lint Ansible Playbook'
uses: ansible/ansible-lint-action@v6
with: 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,18 +0,0 @@
---
name: Ansible check ubuntu:trusty
# 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:trusty
uses: roles-ansible/check-ansible-ubuntu-trusty-action@master
with:
targets: "./"

View file

@ -1,22 +1,24 @@
--- ---
name: Galaxy release name: Galaxy-NG Roles Import
# yamllint disable-line rule:truthy # yamllint disable-line rule:truthy
on: on:
push:
branches: ['main']
release: release:
types: ['created'] types: ['created']
jobs: jobs:
build: build:
name: Galaxy Role Importer
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
- name: 'release on galaxy' steps:
uses: robertdebock/galaxy-action@1.2.0 - 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: with:
galaxy_api_key: ${{ secrets.galaxy_api_key }} 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

@ -4,19 +4,18 @@ galaxy_info:
description: Deploy some dotfiles like .vimrc and .bashrc for all defined users description: Deploy some dotfiles like .vimrc and .bashrc for all defined users
role_name: dotfiles role_name: dotfiles
license: "MIT" license: "MIT"
min_ansible_version: 2.11 min_ansible_version: '2.13'
github_branch: main github_branch: main
platforms: platforms:
- name: Archlinux - name: ArchLinux
versions: all versions: ['all']
- name: Debian - name: Debian
versions: all versions: ['all']
- name: Ubuntu - name: Ubuntu
versions: all versions: ['all']
- name: Fedora
versions: all
galaxy_tags: galaxy_tags:
- dotfiles - dotfiles
- bashrc - bashrc
- vimrc - vimrc
- linux
dependencies: [] dependencies: []

View file

@ -26,7 +26,7 @@
owner: '{{ item }}' owner: '{{ item }}'
group: '{{ item }}' group: '{{ item }}'
mode: 'u=rw,g=r,o=' mode: 'u=rw,g=r,o='
with_items: '{{ accounts }}' loop: '{{ accounts }}'
when: when:
- accounts is defined - accounts is defined
- accounts != ['root'] - accounts != ['root']

View file

@ -1,8 +0,0 @@
---
- name: install the latest libselinux-python package
become: true
ansible.builtin.dnf:
name: libselinux-python
state: present
when: ansible_distribution == "Fedora"
failed_when: false

View file

@ -1,24 +1,23 @@
--- ---
- name: rin optional versionscheck - name: Run optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml ansible.builtin.include_tasks:
file: 'versioncheck.yml'
when: submodules_versioncheck | bool when: submodules_versioncheck | bool
- name: try to install libselinux-python via dnf - name: Deploy .bashrc
ansible.builtin.include_tasks: basic-selinux.yml ansible.builtin.include_tasks:
when: file: 'bashrc.yml'
- dotfiles__install_python_selinux | bool
- ansible_distribution == "Fedora"
- name: deploy .bashrc
ansible.builtin.include_tasks: bashrc.yml
when: dotfiles__modify_bashrc | bool when: dotfiles__modify_bashrc | bool
- name: deploy vimrc - name: Deploy vimrc
ansible.builtin.include_tasks: vimrc.yml ansible.builtin.include_tasks:
file: 'vimrc.yml'
- name: deploy ranger config - name: Deploy ranger config
ansible.builtin.include_tasks: ranger.yml ansible.builtin.include_tasks:
file: 'ranger.yml'
- name: deploy .tmux.conf - name: Deploy .tmux.conf
ansible.builtin.include_tasks: tmux.yml ansible.builtin.include_tasks:
file: 'tmux.yml'
when: dotfiles__modify_tmux | bool when: dotfiles__modify_tmux | bool

View file

@ -1,20 +1,21 @@
--- ---
- name: create .config/ranger/ directory - name: Create .config/ranger/ directory
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "/home/{{ item }}/.config/ranger" path: "/home/{{ item }}/.config/ranger"
state: directory state: directory
owner: "{{ item }}" owner: "{{ item }}"
group: "{{ item }}" group: "{{ item }}"
mode: '0644'
recurse: true recurse: true
with_items: "{{ accounts }}" loop: "{{ accounts }}"
when: when:
- dotfiles__ranger_hidden_files | bool - dotfiles__ranger_hidden_files | bool
- accounts is defined - accounts is defined
- accounts != ['root'] - accounts != ['root']
- accounts != 'root' - accounts != 'root'
- name: create .config/ranger/rc.conf file - name: Create .config/ranger/rc.conf file
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: templates/ranger_rc.conf.j2 src: templates/ranger_rc.conf.j2
@ -22,7 +23,7 @@
owner: "{{ item }}" owner: "{{ item }}"
group: "{{ item }}" group: "{{ item }}"
mode: '0644' mode: '0644'
with_items: "{{ accounts }}" loop: "{{ accounts }}"
when: when:
- dotfiles__ranger_hidden_files | bool - dotfiles__ranger_hidden_files | bool
- accounts is defined - accounts is defined

View file

@ -16,7 +16,7 @@
owner: '{{ item }}' owner: '{{ item }}'
group: '{{ item }}' group: '{{ item }}'
mode: 'u=rw,g=r,o=' mode: 'u=rw,g=r,o='
with_items: "{{ accounts }}" loop: "{{ accounts }}"
when: when:
- accounts is defined - accounts is defined
- accounts != ['root'] - accounts != ['root']

View file

@ -7,38 +7,38 @@
ansible.builtin.file: ansible.builtin.file:
path: '/etc/.ansible-version' path: '/etc/.ansible-version'
state: directory state: directory
mode: 0755 mode: '0755'
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
- name: check playbook version - name: Check playbook version
become: true become: true
ansible.builtin.slurp: ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ playbook_version_path }}" src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version register: playbook_version
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
ignore_errors: true
failed_when: false failed_when: false
- name: Print remote role version - name: Print remote role version # noqa: H500
ansible.builtin.debug: ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
- name: Print locale role version - name: Print locale role version # noqa: H500
ansible.builtin.debug: ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number|string }}'." msg: "Local role version: '{{ playbook_version_number | string }}'."
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
- name: Check if your version is outdated - name: Check if your version is outdated
ansible.builtin.fail: ansible.builtin.fail:
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!" msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
when: when:
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool - 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 become: true
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ playbook_version_number }}" content: "{{ playbook_version_number }}"
dest: "/etc/.ansible-version/{{ playbook_version_path }}" dest: "/etc/.ansible-version/{{ playbook_version_path }}"
mode: '0644' mode: '0644'
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
tags: skip_ansible_lint_template-instead-of-copy

View file

@ -16,7 +16,7 @@
owner: '{{ item }}' owner: '{{ item }}'
group: '{{ item }}' group: '{{ item }}'
mode: 'u=rw,g=r,o=' mode: 'u=rw,g=r,o='
with_items: "{{ accounts }}" loop: "{{ accounts }}"
when: when:
- accounts is defined - accounts is defined
- accounts != ['root'] - accounts != ['root']

View file

@ -1,3 +1,5 @@
# {{ ansible_managed }} {{ ansible_managed | comment }}
# #
{% if dotfiles__ranger_hidden_files | bool %}set show_hidden true{% endif %} {% if dotfiles__ranger_hidden_files | bool %}
set show_hidden true
{% endif %}