Fixed playbooks according to ansible linting

This commit is contained in:
Michele Cereda
2023-01-29 18:19:23 +01:00
parent 03d4278851
commit 1fed953c96
7 changed files with 22 additions and 18 deletions

View File

@@ -22,7 +22,8 @@
name: bluetooth.service
state: restarted
tasks:
- when: ansible_system == 'Linux'
- name: Configure Bluetooth on Linux systems
when: ansible_system == 'Linux'
tags: linux
block:
- name: Configure how long to stay in discoverable mode before going back to non-discoverable
@@ -32,7 +33,7 @@
notify: Restart Bluez
ansible.builtin.lineinfile:
path: "/etc/bluetooth/main.conf"
line: "DiscoverableTimeout = {{ discoverable_timeout|string|lower }}"
line: "DiscoverableTimeout = {{ discoverable_timeout | string | lower }}"
regexp: '^.*DiscoverableTimeout\s*=\s*.*$'
insertafter: '^[General]$'
mode: '0644'
@@ -45,7 +46,7 @@
notify: Restart Bluez
ansible.builtin.lineinfile:
path: "/etc/bluetooth/main.conf"
line: "FastConnectable = {{ fast_connectable|string|lower }}"
line: "FastConnectable = {{ fast_connectable | string | lower }}"
regexp: '^.*FastConnectable\s*=\s*.*$'
insertafter: '^[General]$'
mode: '0644'
@@ -58,7 +59,7 @@
notify: Restart Bluez
ansible.builtin.lineinfile:
path: "/etc/bluetooth/main.conf"
line: "Name = {{ name|string|lower }}"
line: "Name = {{ name | string | lower }}"
regexp: '^.*Name\s*=\s*.*$'
insertafter: '^[General]$'
mode: '0644'
@@ -71,7 +72,7 @@
notify: Restart Bluez
ansible.builtin.lineinfile:
path: "/etc/bluetooth/main.conf"
line: "AutoEnable = {{ auto_enable|string|lower }}"
line: "AutoEnable = {{ auto_enable | string | lower }}"
regexp: '^.*AutoEnable\s*=\s*.*$'
insertafter: '^[Policy]$'
mode: '0644'

View File

@@ -16,7 +16,8 @@
flathub_url: https://flathub.org/repo/flathub.flatpakrepo
remotes: []
tasks:
- when: ansible_system == 'Linux'
- name: Install and configure Flatpak on Linux systems
when: ansible_system == 'Linux'
tags: linux
block:
- name: Install flatpak
@@ -34,8 +35,8 @@
block:
- name: Add flathub to the list of remotes of this run
when: flathub_enabled
set_fact:
remotes: "{{ remotes + [ { 'name': flathub_name, 'method': flathub_method, 'url': flathub_url } ] }}"
ansible.builtin.set_fact:
remotes: "{{ remotes + [{'name': flathub_name, 'method': flathub_method, 'url': flathub_url}] }}"
- name: Enable system remotes
tags:
- remote

View File

@@ -24,14 +24,14 @@
installonly_limit: 2
gpgcheck: true
tasks:
- name: "Configure {{ ansible_pkg_mgr|upper }}"
- name: "Configure {{ ansible_pkg_mgr | upper }}"
when: ansible_pkg_mgr in ['dnf', 'yum']
become: true
ansible.builtin.lineinfile:
path: "/etc/{{ ansible_pkg_mgr }}/{{ ansible_pkg_mgr }}.conf"
line: "{{ item.key }}={{ item.value|string }}"
line: "{{ item.key }}={{ item.value | string }}"
regexp: '^.*{{ item.key }}\s*=\s*.*$'
insertafter: '^[main]$'
mode: '0644'
backup: true
loop: "{{ lookup('vars', [ansible_pkg_mgr, 'config']|join('_') ) | dict2items }}"
loop: "{{ lookup('vars', [ansible_pkg_mgr, 'config'] | join('_')) | dict2items }}"

View File

@@ -12,7 +12,8 @@
- snapd
hosts: all
tasks:
- when: ansible_system == 'Linux'
- name: Install and configure Snap on Linux systems
when: ansible_system == 'Linux'
tags: linux
block:
- name: Install snapd

View File

@@ -13,13 +13,14 @@
swappiness_sysctl_file_priority: 99
swappiness_value: 10
tasks:
- when: ansible_system == 'Linux'
- name: Configure swappiness on Linux systems
when: ansible_system == 'Linux'
tags: linux
block:
- name: Configure swappiness
become: true
sysctl:
ansible.builtin.sysctl:
name: vm.swappiness
value: "{{ swappiness_value|string }}"
value: "{{ swappiness_value | string }}"
sysctl_file: "{{ swappiness_sysctl_file }}"
sysctl_set: true

View File

@@ -10,7 +10,7 @@
tasks:
- name: Pre-flight checks
when: ansible_system != 'Darwin'
fail:
ansible.builtin.fail:
msg: "Unsupported OS '{{ ansible_system }}'"
- name: Check Command Line Tools are already installed
check_mode: false

View File

@@ -1,6 +1,6 @@
---
- name:
- name: Add Packman to Zypper's repositories list
tags:
- opensuse
- packman
@@ -12,7 +12,7 @@
ansible_distribution_with_underscores: "{{ ansible_distribution | replace(' ', '_') }}"
repo_part_distribution: >-
{{
[ansible_distribution_with_underscores, ansible_distribution_version]|join('_')
[ansible_distribution_with_underscores, ansible_distribution_version] | join('_')
if ansible_distribution is search('leap', ignorecase=true)
else ansible_distribution_with_underscores
}}