From c484325f23770f6c6cee89f92be6c38c2c98c222 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 13 Apr 2023 23:19:42 +0200 Subject: [PATCH] improve linting and pylint --- .yamllint | 2 ++ README.md | 2 +- inventory.py | 6 ++++-- setup_desk_minni.yml | 38 -------------------------------------- setup_l14.yml | 39 --------------------------------------- setup_t460p.yml | 38 -------------------------------------- setup_workstation.yml | 38 -------------------------------------- site.yml | 42 +++++++++++++++++++++--------------------- 8 files changed, 28 insertions(+), 177 deletions(-) delete mode 100644 setup_desk_minni.yml delete mode 100644 setup_l14.yml delete mode 100644 setup_t460p.yml delete mode 100644 setup_workstation.yml diff --git a/.yamllint b/.yamllint index be0cacf..283da64 100644 --- a/.yamllint +++ b/.yamllint @@ -9,3 +9,5 @@ rules: ignore: | roles/ + collections/ + ansible/ diff --git a/README.md b/README.md index 42625f3..45b358b 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ python3 -m venv ansible source ansible/bin/activate # Install Ansible -pip3 install ansible-core +pip3 install --upgrade ansible-core ansible-lint pylint ``` Which playbook? diff --git a/inventory.py b/inventory.py index 78957aa..696cd8b 100755 --- a/inventory.py +++ b/inventory.py @@ -28,8 +28,10 @@ def become_pass(host): """ return variable for become password using gopass lookup """ - passstring = str("\"ansible_become_pass\": \"{{ lookup('community.general.passwordstore', 'ansible/hosts/" + host + "/users/root') }}\"") - return passstring + passstring = str("\"ansible_become_pass\": " + + "\"{{ lookup('community.general.passwordstore', 'ansible/hosts/" + + host + "/users/root') }}\"") + return passstring def env(domain): """ diff --git a/setup_desk_minni.yml b/setup_desk_minni.yml deleted file mode 100644 index dec07ef..0000000 --- a/setup_desk_minni.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- name: check if ansible is not to old - hosts: localhost - roles: - - {role: ansible_version, tags: always, gather_facts: false} - -- name: base packages setup - hosts: desk_minni.local - roles: - - {role: workstation_packages, tags: [base, packages, workstation]} - -- name: user and ssh(d) setup - hosts: desk_minni.local - roles: - - {role: do1jlr.users, tags: [users, base]} - - {role: do1jlr.auth, tags: [auth, base]} - - {role: do1jlr.sshd, tags: [sshd, base]} - - {role: dotfiles, tags: [dotfiles, base]} - -- name: fancy schnickschnack - hosts: desk_minni.local - roles: - - {role: akku-warning, tags: akku} - # - {role: pulseaudio, tags: [pulse, audio, pulseaudio]} - - {role: networkmanager, tags: networkmanager, when: ansible_os_family == 'Archlinux'} - - {role: openvpn, tags: ovpn} - - {role: nextcloud, tags: nextcloud, when: ansible_os_family == 'Archlinux'} - - {role: bat, tags: bat, when: ansible_os_family == 'Debian'} - - {role: install-firefox, tags: firefox} - - {role: copy_files} - - {role: do1jlr.i3wm, tags: i3wm} - - {role: ntp, tags: ntp} - - {role: xrandr, tags: xrandr} - - {role: arch-fonts, tags: fonts} - # - {role: winehq, tags: wine} - - {role: no-sleep, tags: sleep} - - {role: do1jlr.avahi_daemon, tags: [avahi_daemon, avahi]} - - {role: do1jlr.avahi_client, tags: [avahi_client, mdns]} diff --git a/setup_l14.yml b/setup_l14.yml deleted file mode 100644 index 3fc3975..0000000 --- a/setup_l14.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- name: check if ansible is not to old - hosts: localhost - roles: - - {role: ansible_version, tags: always, gather_facts: false} - -- name: base packages setup - hosts: l14.local - roles: - - {role: workstation_packages, tags: [base, packages, workstation]} - - {role: amdgpu_firmware, tags: [amdgpu, firmware]} - -- name: user and ssh(d) setup - hosts: l14.local - roles: - - {role: do1jlr.users, tags: [users, base]} - - {role: do1jlr.auth, tags: [auth, base]} - - {role: do1jlr.sshd, tags: [sshd, base]} - - {role: dotfiles, tags: [dotfiles, base]} - -- name: fancy schnickschnack - hosts: l14.local - roles: - - {role: akku-warning, tags: akku} - # - {role: pulseaudio, tags: [pulse, audio, pulseaudio]} - - {role: networkmanager, tags: networkmanager, when: ansible_os_family == 'Archlinux'} - - {role: openvpn, tags: ovpn} - - {role: nextcloud, tags: nextcloud, when: ansible_os_family == 'Archlinux'} - - {role: bat, tags: bat, when: ansible_os_family == 'Debian'} - - {role: install-firefox, tags: firefox} - - {role: copy_files} - - {role: do1jlr.i3wm, tags: i3wm} - - {role: ntp, tags: ntp} - - {role: xrandr, tags: xrandr} - - {role: arch-fonts, tags: fonts} - # - {role: winehq, tags: wine} - - {role: no-sleep, tags: sleep} - - {role: do1jlr.avahi_daemon, tags: [avahi_daemon, avahi]} - - {role: do1jlr.avahi_client, tags: [avahi_client, mdns]} diff --git a/setup_t460p.yml b/setup_t460p.yml deleted file mode 100644 index 00f38a8..0000000 --- a/setup_t460p.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- name: check if ansible is not to old - hosts: localhost - roles: - - {role: ansible_version, tags: always, gather_facts: false} - -- name: base packages setup - hosts: t460p.local - roles: - - {role: workstation_packages, tags: [base, packages, workstation]} - -- name: user and ssh(d) setup - hosts: t460p.local - roles: - - {role: do1jlr.users, tags: [users, base]} - - {role: do1jlr.auth, tags: [auth, base]} - - {role: do1jlr.sshd, tags: [sshd, base]} - - {role: dotfiles, tags: [dotfiles, base]} - -- name: fancy schnickschnack - hosts: t460p.local - roles: - - {role: akku-warning, tags: akku} - # - {role: pulseaudio, tags: [pulse, audio, pulseaudio]} - - {role: networkmanager, tags: networkmanager, when: ansible_os_family == 'Archlinux'} - - {role: openvpn, tags: ovpn} - - {role: nextcloud, tags: nextcloud, when: ansible_os_family == 'Archlinux'} - - {role: bat, tags: bat, when: ansible_os_family == 'Debian'} - - {role: install-firefox, tags: firefox} - - {role: copy_files} - - {role: do1jlr.i3wm, tags: i3wm} - - {role: ntp, tags: ntp} - - {role: xrandr, tags: xrandr} - - {role: arch-fonts, tags: fonts} - # - {role: winehq, tags: wine} - - {role: no-sleep, tags: sleep} - - {role: do1jlr.avahi_daemon, tags: [avahi_daemon, avahi]} - - {role: do1jlr.avahi_client, tags: [avahi_client, mdns]} diff --git a/setup_workstation.yml b/setup_workstation.yml deleted file mode 100644 index 825dbdd..0000000 --- a/setup_workstation.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- name: check if ansible is not to old - hosts: localhost - roles: - - {role: ansible_version, tags: always, gather_facts: false} - -- name: base packages setup - hosts: workstation.local - roles: - - {role: workstation_packages, tags: [base, packages, workstation]} - -- name: user and ssh(d) setup - hosts: workstation.local - roles: - - {role: do1jlr.users, tags: [users, base]} - - {role: do1jlr.auth, tags: [auth, base]} - - {role: do1jlr.sshd, tags: [sshd, base]} - - {role: dotfiles, tags: [dotfiles, base]} - -- name: fancy schnickschnack - hosts: workstation.local - roles: - - {role: akku-warning, tags: akku} - - {role: pulseaudio, tags: [pulse, audio, pulseaudio]} - - {role: networkmanager, tags: networkmanager, when: ansible_os_family == 'Archlinux'} - - {role: openvpn, tags: ovpn} - - {role: nextcloud, tags: nextcloud, when: ansible_os_family == 'Archlinux'} - - {role: bat, tags: bat, when: ansible_os_family == 'Debian'} - - {role: install-firefox, tags: firefox} - - {role: copy_files} - - {role: do1jlr.i3wm, tags: i3wm} - - {role: ntp, tags: ntp} - - {role: xrandr, tags: xrandr} - - {role: arch-fonts, tags: fonts} - - {role: winehq, tags: wine} - - {role: no-sleep, tags: sleep} - - {role: do1jlr.avahi_daemon, tags: [avahi_daemon, avahi]} - - {role: do1jlr.avahi_client, tags: [avahi_client, mdns]} diff --git a/site.yml b/site.yml index 93b41d6..2c27f54 100644 --- a/site.yml +++ b/site.yml @@ -16,28 +16,28 @@ - name: run do1jlr.base setup roles hosts: all roles: - #- {role: do1jlr.base, tags: [default, packages, base]} - #- {role: workstation_packages, tags: [default, workstation_packages, packages, setup]} + # - {role: do1jlr.base, tags: [default, packages, base]} + # - {role: workstation_packages, tags: [default, workstation_packages, packages, setup]} - {role: ntp, tags: ntp} - {role: do1jlr.avahi_client, tags: avahi} - {role: do1jlr.avahi_daemon, tags: avahi} - #- {role: arch-fonts, tags: [font, fonts, arch-fonts]} + # - {role: arch-fonts, tags: [font, fonts, arch-fonts]} -#- name: user specific setup -# hosts: private -# roles: - #- {role: dotfiles, tags: [default, dotfiles, fancy]} - #- {role: manage_users, tags: [ssh, manage, manage_users]} - #- {role: authorized_keys, tags: [ssh, auth, authorized_keys]} - #- {role: sshd, tags: [ssh, sshd]} - #- {role: akku-warning, tags: [akku, akku_warning, akku-warning]} - #- {role: pulseaudio, tags: pulseaudio} - #- {role: networkmanager, tags: [nm, networkmanager]} - #- {role: copy_files} - #- {role: do1jlr.i3wm, tags: i3wm} - # - {role: xrandr, tags: xrandr} - #- {role: install-firefox, tags: firefox} - #- {role: nextcloud, tags: nextcloud} - #- {role: openvpn, tags: openvpn} - #- {role: winehq, tags: [wine, winehq]} - #- {role: no-sleep, tags: no_sleep} +# - name: user specific setup +# hosts: private +# roles: +# - {role: dotfiles, tags: [default, dotfiles, fancy]} +# - {role: manage_users, tags: [ssh, manage, manage_users]} +# - {role: authorized_keys, tags: [ssh, auth, authorized_keys]} +# - {role: sshd, tags: [ssh, sshd]} +# - {role: akku-warning, tags: [akku, akku_warning, akku-warning]} +# - {role: pulseaudio, tags: pulseaudio} +# - {role: networkmanager, tags: [nm, networkmanager]} +# - {role: copy_files} +# - {role: do1jlr.i3wm, tags: i3wm} +# - {role: xrandr, tags: xrandr} +# - {role: install-firefox, tags: firefox} +# - {role: nextcloud, tags: nextcloud} +# - {role: openvpn, tags: openvpn} +# - {role: winehq, tags: [wine, winehq]} +# - {role: no-sleep, tags: no_sleep}