1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_weechat.git synced 2024-07-06 20:38:53 +02:00

improve linting and update meta info

This commit is contained in:
L3D 2023-03-01 21:27:09 +01:00
parent bb32c056a3
commit e8db239e25
Signed by: l3d
GPG key ID: CD08445BFF4313D1
13 changed files with 77 additions and 63 deletions

View file

@ -10,6 +10,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
steps:

View file

@ -1,4 +1,5 @@
[![Ansible Galaxy](https://raw.githubusercontent.com/chaos-bodensee/role_weechat/master/.github/galaxy.svg?sanitize=true)](https://galaxy.ansible.com/do1jlr/weechat) [![MIT License](https://raw.githubusercontent.com/chaos-bodensee/role_weechat/master/.github/license.svg?sanitize=true)](https://github.com/chaos-bodensee/role_weechat/blob/master/LICENSE)
[![Ansible Galaxy](https://raw.githubusercontent.com/roles-ansible/ansible_role_weechat/main/.github/galaxy.svg)](https://galaxy.ansible.com/do1jlr/weechat)
[![MIT License](https://raw.githubusercontent.com/roles-ansible/ansible_role_weechat/main/.github/license.svg?sanitize=true)](https://github.com/roles-ansible/ansible_role_weechat/blob/main/LICENSE)
ansible weechat role
==========================

View file

@ -1,5 +1,5 @@
---
- name: systemctl restart weechat.service
- name: Run systemctl restart weechat.service
become: true
ansible.builtin.systemd:
state: restarted

View file

@ -4,18 +4,19 @@ galaxy_info:
author: do1jlr
description: Install and optional configure weechat via ansible
license: "MIT"
min_ansible_version: 2.11
github_branch: main
min_ansible_version: '2.14'
platforms:
- name: Archlinux
versions: all
- name: Debian
versions: all
- name: Ubuntu
versions: all
- name: Fedora
versions: all
- name: 'ArchLinux'
versions: ['all']
- name: 'Debian'
versions: ['all']
- name: 'Ubuntu'
versions: ['all']
- name: 'Fedora'
versions: ['all']
galaxy_tags:
- weechat
- irc
- chat
- textmessages
dependencies: []

View file

@ -1,5 +1,5 @@
---
- name: create ssh key pair (if needed)
- name: Create ssh key pair (if needed)
become: true
community.crypto.openssh_keypair:
path: "{{ weechat__home_directory }}/.ssh/id_ed25519"
@ -8,7 +8,7 @@
register: ssh_key_pair
when: weechat__custom_gen_ssh_key_pair | bool
- name: print ssh public key to user
- name: Print ssh public key to user
ansible.builtin.pause:
prompt: |
We generated a new ssh key pair for you.
@ -32,36 +32,46 @@
- weechat__custom_gen_ssh_key_pair | bool
- ssh_key_pair.changed
- name: clone or update private git repository
- name: "Change git repo owner to root"
become: true
ansible.builtin.file:
path: "{{ weechat__home_directory }}/.weechat"
recurse: true
owner: "root"
changed_when: ssh_key_pair.changed
when: not weechat__custom_private_repo | bool
- name: Clone or update private git repository
become: true
when: not weechat__custom_private_repo | bool
block:
- name: try to download/update git repo
- name: Try to download/update git repo
ansible.builtin.git:
repo: "{{ weechat__custom_private_repo }}"
dest: "{{ weechat__home_directory }}/.weechat"
version: "{{ weechat__custom_config.version | default ('main') }}"
version: "{{ weechat__custom_config.version | default('main') }}"
accept_hostkey: true
update: true
ssh_opts: "-i {{ weechat__home_directory }}/.ssh/id_ed25519"
rescue:
- name: wait until you fixed remote git issues
- name: Wait until you fixed remote git issues
ansible.builtin.pause:
prompt: "Please fix the issue with your git repository and try again"
- name: try to download/update git repo again
- name: Try to download/update git repo again
ansible.builtin.git:
repo: "{{ weechat__custom_private_repo }}"
dest: "{{ weechat__home_directory }}/.weechat"
version: "{{ weechat__custom_config.version | default ('main') }}"
version: "{{ weechat__custom_config.version | default('main') }}"
accept_hostkey: true
update: true
ssh_opts: "-i {{ weechat__home_directory }}/.ssh/id_ed25519"
when: not weechat__custom_private_repo | bool
- name: "change git repo owner to {{ weechat__user }}"
- name: "Change git repo owner to {{ weechat__user }}"
become: true
ansible.builtin.file:
path: "{{ weechat__home_directory }}/.weechat"
recurse: true
owner: "{{ weechat__user }}"
changed_when: ssh_key_pair.changed
when: not weechat__custom_private_repo | bool

View file

@ -1,5 +1,5 @@
---
- name: create weechat directory
- name: Create weechat directory
become: true
ansible.builtin.file:
path: "{{ weechat__home_directory }}/.weechat"
@ -7,7 +7,7 @@
owner: "{{ weechat__user }}"
mode: "0750"
- name: create weechat plugins directory
- name: Create weechat plugins directory
become: true
ansible.builtin.file:
path: "{{ weechat__home_directory }}/.weechat/{{ item.value }}/autoload"
@ -16,16 +16,16 @@
mode: "0750"
with_dict: "{{ weechat_plugin_languages }}"
- name: download weechat plugins
- name: Download weechat plugins
ansible.builtin.get_url:
url: 'https://weechat.org/files/scripts/{{ item }}'
dest: "{{ weechat__home_directory }}/.weechat/{{ weechat_plugin_languages[item.split('.',1)[-1]] }}/{{ item }}"
dest: "{{ weechat__home_directory }}/.weechat/{{ weechat_plugin_languages[item.split('.', 1)[-1]] }}/{{ item }}"
mode: '0644'
with_items: '{{ weechat__plugins }}'
- name: symlinking plugins to autoload
- name: Symlinking plugins to autoload
ansible.builtin.file:
src: "{{ weechat__home_directory }}/.weechat/{{ weechat_plugin_languages[item.split('.',1)[-1]] }}/{{ item }}"
dest: "{{ weechat__home_directory }}/.weechat/{{ weechat_plugin_languages[item.split('.',1)[-1]] }}/autoload/{{ item }}"
src: "{{ weechat__home_directory }}/.weechat/{{ weechat_plugin_languages[item.split('.', 1)[-1]] }}/{{ item }}"
dest: "{{ weechat__home_directory }}/.weechat/{{ weechat_plugin_languages[item.split('.', 1)[-1]] }}/autoload/{{ item }}"
state: link
with_items: '{{ weechat__plugins }}'

View file

@ -1,5 +1,5 @@
---
- name: install weechat if available
- name: Install weechat if available
become: true
ansible.builtin.package:
name:

View file

@ -1,5 +1,5 @@
---
- name: install apt-transport-https
- name: Install apt-transport-https
become: true
ansible.builtin.apt:
name: apt-transport-https
@ -12,21 +12,21 @@
id: "{{ weechat__gpg_id }}"
state: present
- name: add weechat repo
- name: Add weechat repo
become: true
ansible.builtin.apt_repository:
repo: "deb {{ weechat__debian_weechat_repo }}"
state: present
update_cache: true
- name: add weechat repo-src
- name: Add weechat repo-src
become: true
ansible.builtin.apt_repository:
repo: "deb-src {{ weechat__debian_weechat_repo }}"
state: present
update_cache: true
- name: install recomended weechat packages
- name: Install recomended weechat packages
become: true
ansible.builtin.apt:
name:

View file

@ -1,5 +1,5 @@
---
- name: install weechat if available
- name: Install weechat if available
become: true
ansible.builtin.package:
name:

View file

@ -1,20 +1,20 @@
---
- name: perform optinal versionscheck
- name: Perform optinal versionscheck
ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck|bool
- name: install weechat
ansible.builtin.include_tasks: "install-{{ ansible_os_family|lower }}.yml"
- name: Install weechat
ansible.builtin.include_tasks: "install-{{ ansible_os_family | lower }}.yml"
when: weechat__install | bool
- name: deploy weechat__configuration
- name: Deploy weechat__configuration
ansible.builtin.include_tasks: configure_custom_config.yml
when: weechat__use_custom_config | bool
- name: install requirements for weechat__plugins
- name: Install requirements for weechat__plugins
ansible.builtin.include_tasks: configure_plugins.yml
when: weechat__install_plugins | bool
- name: setup weechat__autostart
- name: Setup weechat__autostart
ansible.builtin.include_tasks: setup_autostart.yml
when: weechat__autostart | bool

View file

@ -1,12 +1,12 @@
---
- name: install tmux to launch weechat
- name: Install tmux to launch weechat
become: true
ansible.builtin.package:
name: tmux
state: present
when: weechat__install | bool
- name: copy systemd service for weechat
- name: Copy systemd service for weechat
become: true
ansible.builtin.template:
src: templates/weechat.service
@ -14,13 +14,13 @@
owner: root
group: root
mode: '0644'
notify: systemctl restart weechat.service
notify: Run systemctl restart weechat.service
- name: enable weechat.service
- name: Enable weechat.service
become: true
ansible.builtin.systemd:
enabled: true
state: started
name: weechat.service
daemon_reload: true
notify: systemctl restart weechat.service
notify: Run systemctl restart weechat.service

View file

@ -8,37 +8,38 @@
path: '/etc/.ansible-version'
state: directory
mode: 0755
when: submodules_versioncheck|bool
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
when: submodules_versioncheck|bool
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 }}"
when: submodules_versioncheck|bool
when: submodules_versioncheck | bool
- name: Print locale role version
ansible.builtin.debug:
msg: "Local role version: '{{ playbook_version_number|string }}'."
when: submodules_versioncheck|bool
msg: "Local role version: '{{ playbook_version_number | string }}'."
when: submodules_versioncheck | bool
- name: Check if your version is outdated
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
- 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
when: submodules_versioncheck | bool
tags: skip_ansible_lint_template-instead-of-copy

View file

@ -1,15 +1,15 @@
---
# weechat plugin languages
weechat_plugin_languages:
pl: perl
scm: guile
js: javascript
py: python
rb: ruby
lua: lua
pl: 'perl'
scm: 'guile'
js: 'javascript'
py: 'python'
rb: 'ruby'
lua: 'lua'
# version management
playbook_version_number: 4221 # should be over ninethousand
playbook_version_number: 4222 # should be over ninethousand
playbook_version_path: 'role-weechat_roles-ansible_github.com.version'
weechat__debian_weechat_repo: "https://weechat.org/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} main"
weechat__debian_weechat_repo: "https://weechat.org/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} main"