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: galaxy_info:
role_name: i3wm role_name: i3wm
author: do1jlr author: l3d
description: Install and configure i3wm on common linux distibutions (https://i3wm.org/) description: Install and configure i3wm on common linux distibutions (https://i3wm.org/)
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 - name: Fedora
versions: all versions: ['all']
galaxy_tags: galaxy_tags:
- i3wm - i3wm
- desktop - desktop
- linux - linux
- xorg - xorg
- wayland - linux
dependencies: [] dependencies: []

View file

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

View file

@ -1,22 +1,22 @@
--- ---
- name: run optional versionscheck - name: Run optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml 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 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 ansible.builtin.include_tasks: setup-Debian.yml
when: ansible_os_family == 'Debian' 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 ansible.builtin.include_tasks: setup-Archlinux.yml
when: ansible_os_family == 'Archlinux' 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 ansible.builtin.include_tasks: setup-RedHat.yml
when: ansible_os_family == 'Fedora' or ansible_os_family == 'RedHat' 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 ansible.builtin.include_tasks: config.yml

View file

@ -1,6 +1,6 @@
--- ---
- name: ensure i3 packages are installed. - name: Ensure i3 packages are installed.
ansible.builtin.pacman: community.general.pacman:
name: "{{ i3_packages }}" name: "{{ i3_packages }}"
state: present state: present
update_cache: true 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: ansible.builtin.apt:
name: "{{ i3_packages }}" name: "{{ i3_packages }}"
state: "present" state: "present"

View file

@ -1,5 +1,5 @@
--- ---
- name: ensure i3 packages are installed. - name: Ensure i3 packages are installed.
ansible.builtin.dnf: ansible.builtin.dnf:
name: "{{ i3_packages }}" name: "{{ i3_packages }}"
state: present 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" ansible.builtin.include_vars: "{{ ansible_os_family }}.yml"
when: ansible_distribution != "Fedora" when: ansible_distribution != "Fedora"
- name: register Fedora variables - name: Register Fedora-specific variables
ansible.builtin.include_vars: "{{ ansible_distribution }}.yml" ansible.builtin.include_vars: "{{ ansible_distribution }}.yml"
when: ansible_distribution == "Fedora" when: ansible_distribution == "Fedora"
# i3 packages - name: Define i3_packages
- name: define i3_packages
ansible.builtin.set_fact: ansible.builtin.set_fact:
i3_packages: "{{ __i3_packages | list }}" i3_packages: "{{ __i3_packages | list }}"
when: i3_packages is not defined when: i3_packages is not defined
- name: define i3_packages_extra - name: Define i3_packages_extra
ansible.builtin.set_fact: ansible.builtin.set_fact:
i3_packages: "{{ i3_packages | list + i3_packages_extra | list }}" i3_packages: "{{ i3_packages | list + i3_packages_extra | list }}"
when: i3_packages_extra is defined when: i3_packages_extra is defined
# i3 workspaces - name: Define i3_packages
- name: define i3_packages
ansible.builtin.set_fact: ansible.builtin.set_fact:
i3_workspaces: "{{ __i3_workspaces | list }}" i3_workspaces: "{{ __i3_workspaces | list }}"
when: i3_workspaces is not defined when: i3_workspaces is not defined
# i3 keybindings - name: Define i3_keybindings
- name: define i3_packages
ansible.builtin.set_fact: ansible.builtin.set_fact:
i3_keybindings: "{{ __i3_keybindings | list }}" i3_keybindings: "{{ __i3_keybindings | list }}"
when: when:
- i3_keybindings is not defined - i3_keybindings is not defined
- __i3_keybindings is defined - __i3_keybindings is defined
- name: define extra i3 keybindings - name: Define additional i3 keybindings
ansible.builtin.set_fact: ansible.builtin.set_fact:
i3_keybindings: "{{ i3_keybindings_extra | list + i3_keybindings | list }}" i3_keybindings: "{{ i3_keybindings_extra | list + i3_keybindings | list }}"
when: when:
- i3_keybindings_extra is defined - i3_keybindings_extra is defined
- i3_keybindings is defined - i3_keybindings is defined
- name: define extra i3 keybindings - name: Finalize i3 keybindings definition
ansible.builtin.set_fact: ansible.builtin.set_fact:
i3_keybindings: "{{ i3_keybindings_extra | list }}" i3_keybindings: "{{ i3_keybindings_extra | list }}"
when: when:

View file

@ -8,37 +8,38 @@
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: i3wm_playbook_version
when: submodules_versioncheck|bool when: submodules_versioncheck | bool
ignore_errors: true ignore_errors: true
failed_when: false failed_when: false
- name: Print remote role version - name: Print remote role version
ansible.builtin.debug: 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 when: submodules_versioncheck | bool
- name: Print locale role version - name: Print locale role version
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 - 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 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

@ -33,5 +33,5 @@ __i3_workspaces:
user: "{{ i3wm_user }}" 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' playbook_version_path: 'role-i3wm_chaos-bodensee_github.com.version'