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

Update ansible lint

This commit is contained in:
L3D 2023-05-19 17:07:00 +02:00
parent 6fbf3f2efc
commit 1e2f686850
Signed by: l3d
GPG key ID: CD08445BFF4313D1
9 changed files with 54 additions and 48 deletions

View file

@ -1,24 +1,24 @@
---
galaxy_info:
role_name: i3wm
author: do1jlr
author: l3d
description: Install and configure i3wm on common linux distibutions (https://i3wm.org/)
license: "MIT"
min_ansible_version: 2.11
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']
galaxy_tags:
- i3wm
- desktop
- linux
- xorg
- wayland
- linux
dependencies: []

View file

@ -8,7 +8,7 @@
owner: "{{ i3wm_user }}"
group: "{{ i3wm_user }}"
- name: create i3 config folder
- name: Create i3 config folder
become: true
ansible.builtin.file:
path: '/home/{{ i3wm_user }}/.config/i3/'
@ -17,7 +17,7 @@
owner: "{{ i3wm_user }}"
group: "{{ i3wm_user }}"
- name: copy multiple images
- name: Copy multiple images
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
@ -29,7 +29,7 @@
- { src: 'files/lockscreen.png', dest: '/home/{{ i3wm_user }}/.config/lockscreen.png' }
when: i3wm_copy_wallpapers | bool
- name: copy and validate i3wm config file
- name: Copy and validate i3wm config file
become: true
ansible.builtin.template:
src: templates/config.j2
@ -41,7 +41,7 @@
group: "{{ i3wm_user }}"
# todo: rewrite user stuff and support multiple users
- name: mkdir ~/.config/i3blocks/
- name: Mkdir ~/.config/i3blocks/
become: true
ansible.builtin.file:
path: "/home/{{ i3wm_user }}/.config/i3blocks/"
@ -50,7 +50,7 @@
owner: "{{ i3wm_user }}"
group: "{{ i3wm_user }}"
- name: copy i3blocks config
- name: Copy i3blocks config
become: true
ansible.builtin.copy:
src: "files/i3blocks/config"
@ -59,7 +59,7 @@
owner: "{{ i3wm_user }}"
group: "{{ i3wm_user }}"
- name: copy i3blocks config
- name: Copy i3blocks config
become: true
ansible.builtin.copy:
src: "files/i3blocks/{{ item }}"

View file

@ -1,22 +1,22 @@
---
- name: run optional versionscheck
- name: Run optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck|bool
when: submodules_versionchecki | bool
- name: register variables
- name: Register variables
ansible.builtin.import_tasks: variables.yml
- name: ensure i3 packages are installed [Debian]
- name: Ensure i3 packages are installed [Debian]
ansible.builtin.include_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian'
- name: ensure i3 packages are installed [Archlinux}
- name: Ensure i3 packages are installed [Archlinux}
ansible.builtin.include_tasks: setup-Archlinux.yml
when: ansible_os_family == 'Archlinux'
- name: ensure i3 packages are installed [RHEL].
- name: Ensure i3 packages are installed [RHEL].
ansible.builtin.include_tasks: setup-RedHat.yml
when: ansible_os_family == 'Fedora' or ansible_os_family == 'RedHat'
- name: create i3 config file
- name: Create i3 config file
ansible.builtin.include_tasks: config.yml

View file

@ -1,6 +1,6 @@
---
- name: ensure i3 packages are installed.
ansible.builtin.pacman:
- name: Ensure i3 packages are installed.
community.general.pacman:
name: "{{ i3_packages }}"
state: present
update_cache: true

View file

@ -1,5 +1,13 @@
---
- name: ensure i3 packages are installed.
- name: Update apt cache
become: true
ansible.builtin.apt:
cache_valid_time: 3600
update_cache: true
when:
- ansible_pkg_mgr == "apt"
- name: Ensure i3 packages are installed.
ansible.builtin.apt:
name: "{{ i3_packages }}"
state: "present"

View file

@ -1,5 +1,5 @@
---
- name: ensure i3 packages are installed.
- name: Ensure i3 packages are installed.
ansible.builtin.dnf:
name: "{{ i3_packages }}"
state: present

View file

@ -1,45 +1,42 @@
---
- name: register os-specific variables
- name: Register OS-specific Variables
ansible.builtin.include_vars: "{{ ansible_os_family }}.yml"
when: ansible_distribution != "Fedora"
- name: register Fedora variables
- name: Register Fedora-specific variables
ansible.builtin.include_vars: "{{ ansible_distribution }}.yml"
when: ansible_distribution == "Fedora"
# i3 packages
- name: define i3_packages
- name: Define i3_packages
ansible.builtin.set_fact:
i3_packages: "{{ __i3_packages | list }}"
when: i3_packages is not defined
- name: define i3_packages_extra
- name: Define i3_packages_extra
ansible.builtin.set_fact:
i3_packages: "{{ i3_packages | list + i3_packages_extra | list }}"
when: i3_packages_extra is defined
# i3 workspaces
- name: define i3_packages
- name: Define i3_packages
ansible.builtin.set_fact:
i3_workspaces: "{{ __i3_workspaces | list }}"
when: i3_workspaces is not defined
# i3 keybindings
- name: define i3_packages
- name: Define i3_keybindings
ansible.builtin.set_fact:
i3_keybindings: "{{ __i3_keybindings | list }}"
when:
- i3_keybindings is not defined
- __i3_keybindings is defined
- name: define extra i3 keybindings
- name: Define additional i3 keybindings
ansible.builtin.set_fact:
i3_keybindings: "{{ i3_keybindings_extra | list + i3_keybindings | list }}"
when:
- i3_keybindings_extra is defined
- i3_keybindings is defined
- name: define extra i3 keybindings
- name: Finalize i3 keybindings definition
ansible.builtin.set_fact:
i3_keybindings: "{{ i3_keybindings_extra | list }}"
when:

View file

@ -10,18 +10,18 @@
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
register: i3wm_playbook_version
when: submodules_versioncheck | bool
ignore_errors: true
failed_when: false
- name: Print remote role version
ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
msg: "Remote role version: {{ i3wm_playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
when: submodules_versioncheck | bool
- name: Print locale role version
@ -33,12 +33,13 @@
ansible.builtin.fail:
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
when:
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
- i3wm_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

@ -33,5 +33,5 @@ __i3_workspaces:
user: "{{ i3wm_user }}"
playbook_version_number: 9024 # should be int
playbook_version_number: 9025 # should be int
playbook_version_path: 'role-i3wm_chaos-bodensee_github.com.version'