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

Merge pull request #19 from roles-ansible/f

improve linting and adding requirements
This commit is contained in:
L3D 2023-10-28 16:27:32 +02:00 committed by GitHub
commit 3c16e7d5e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 16 deletions

View file

@ -100,3 +100,10 @@ For a good overview about possible variables, please have a look into ``defaults
# choose rofi theme
i3_rofi_config_file: 'files/rofi/dracula_dark.rasi'
```
## 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
```

4
requirements.yml Normal file
View file

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

View file

@ -25,7 +25,7 @@
mode: 0644
owner: "{{ i3wm_usr.user }}"
group: "{{ i3wm_usr.user }}"
with_items:
loop:
- { src: 'files/background.png', dest: "{{ i3wm_usr.home }}/.config/background.png" }
- { src: 'files/lockscreen.png', dest: '{{ i3wm_usr.home }}/.config/lockscreen.png' }
when: i3wm_copy_wallpapers | bool
@ -67,7 +67,7 @@
mode: 0750
owner: "{{ i3wm_usr.user }}"
group: "{{ i3wm_usr.user }}"
with_items:
loop:
- 'volume.sh'
- 'wlan.py'
- 'battery.py'

View file

@ -1,25 +1,31 @@
---
- name: Run optional versionscheck
ansible.builtin.include_tasks: versioncheck.yml
ansible.builtin.include_tasks:
file: versioncheck.yml
when: submodules_versioncheck | bool
- name: Register variables
ansible.builtin.import_tasks: variables.yml
ansible.builtin.import_tasks:
file: variables.yml
- name: Ensure i3 packages are installed [Debian]
ansible.builtin.include_tasks: setup-Debian.yml
ansible.builtin.include_tasks:
file: setup-Debian.yml
when: ansible_os_family == 'Debian'
- name: Ensure i3 packages are installed [Archlinux}
ansible.builtin.include_tasks: setup-Archlinux.yml
ansible.builtin.include_tasks:
file: setup-Archlinux.yml
when: ansible_os_family == 'Archlinux'
- name: Ensure i3 packages are installed [RHEL].
ansible.builtin.include_tasks: setup-RedHat.yml
ansible.builtin.include_tasks:
file: setup-RedHat.yml
when: ansible_os_family == 'Fedora' or ansible_os_family == 'RedHat'
- name: Create i3 config file
ansible.builtin.include_tasks: config.yml
ansible.builtin.include_tasks:
file: config.yml
loop: "{{ i3wm_user_list | flatten(1) }}"
loop_control:
loop_var: i3wm_usr

View file

@ -1,10 +1,12 @@
---
- name: Register OS-specific Variables
ansible.builtin.include_vars: "{{ ansible_os_family }}.yml"
ansible.builtin.include_vars:
file: "{{ ansible_os_family }}.yml"
when: ansible_distribution != "Fedora"
- name: Register Fedora-specific variables
ansible.builtin.include_vars: "{{ ansible_distribution }}.yml"
ansible.builtin.include_vars:
file: "{{ ansible_distribution }}.yml"
when: ansible_distribution == "Fedora"
- name: Define i3_packages

View file

@ -14,17 +14,16 @@
become: true
ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: i3wm_playbook_version
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: {{ i3wm_playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
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
@ -33,7 +32,7 @@
ansible.builtin.fail:
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
when:
- i3wm_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
become: true