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

huge commit, updating role to ansible 2.11

+ update to ansible 2.11
+ improved linting
+ delete travis
+ increase version
+ update meta data
This commit is contained in:
L3D 2021-05-27 14:14:13 +02:00
parent 05fafe3375
commit eaa4a63cae
Signed by: l3d
GPG key ID: CD08445BFF4313D1
31 changed files with 237 additions and 175 deletions

1
.github/FUNDING.yml vendored
View file

@ -1,3 +1,4 @@
---
# These are supported funding model platforms # These are supported funding model platforms
github: [do1jlr] github: [do1jlr]

View file

@ -1,5 +1,7 @@
---
name: Ansible check archlinux:latest name: Ansible check archlinux:latest
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with archlinux:latest - name: ansible check with archlinux:latest
uses: roles-ansible/check-ansible-archlinux-latest-action@master uses: roles-ansible/check-ansible-archlinux-latest-action@master
with: with:
targets: "./" targets: "./"

View file

@ -0,0 +1,18 @@
---
name: Ansible check centos:latest
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with ubuntu:latest
uses: roles-ansible/check-ansible-centos-latest-action@master
with:
targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check debian:buster name: Ansible check debian:buster
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with debian:buster - name: ansible check with debian:buster
uses: roles-ansible/check-ansible-debian-buster-action@master uses: roles-ansible/check-ansible-debian-buster-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check debian:latest name: Ansible check debian:latest
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with debian:latest - name: ansible check with debian:latest
uses: roles-ansible/check-ansible-debian-latest-action@master uses: roles-ansible/check-ansible-debian-latest-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check debian:sid name: Ansible check debian:sid
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with debian:sid - name: ansible check with debian:sid
uses: roles-ansible/check-ansible-debian-sid-action@master uses: roles-ansible/check-ansible-debian-sid-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check debian:stable name: Ansible check debian:stable
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with debian:stable - name: ansible check with debian:stable
uses: roles-ansible/check-ansible-debian-stable-action@master uses: roles-ansible/check-ansible-debian-stable-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check debian:stretch name: Ansible check debian:stretch
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with debian:stretch - name: ansible check with debian:stretch
uses: roles-ansible/check-ansible-debian-stretch-action@master uses: roles-ansible/check-ansible-debian-stretch-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check fedora:31 name: Ansible check fedora:31
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with fedora:31 - name: ansible check with fedora:31
uses: roles-ansible/check-ansible-fedora-31-action@master uses: roles-ansible/check-ansible-fedora-31-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check fedora:32 name: Ansible check fedora:32
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with fedora:32 - name: ansible check with fedora:32
uses: roles-ansible/check-ansible-fedora-32-action@master uses: roles-ansible/check-ansible-fedora-32-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check fedora:33 name: Ansible check fedora:33
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with fedora:33 - name: ansible check with fedora:33
uses: roles-ansible/check-ansible-fedora-33-action@master uses: roles-ansible/check-ansible-fedora-33-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check fedora:latest name: Ansible check fedora:latest
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with fedora:latest - name: ansible check with fedora:latest
uses: roles-ansible/check-ansible-fedora-latest-action@master uses: roles-ansible/check-ansible-fedora-latest-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,6 +1,14 @@
---
name: Ansible Lint check name: Ansible Lint check
on: [push, pull_request] # yamllint disable-line rule:truthy
on:
push:
branches: '*'
pull_request:
branches: '*'
schedule:
- cron: '42 6 * */1 *'
jobs: jobs:
build: build:
@ -8,13 +16,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Lint Ansible Playbook - name: Lint Ansible Playbook
uses: ansible/ansible-lint-action@master uses: ansible/ansible-lint-action@master
with: with:
targets: "." targets: "."
# [required] # [required]
# Paths to ansible files (i.e., playbooks, tasks, handlers etc..) # Paths to ansible files (i.e., playbooks, tasks, handlers etc..)
args: "" args: ""
# [optional] # [optional]

View file

@ -1,5 +1,7 @@
---
name: Ansible check ubuntu:bionic name: Ansible check ubuntu:bionic
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with ubuntu:bionic - name: ansible check with ubuntu:bionic
uses: roles-ansible/check-ansible-ubuntu-bionic-action@master uses: roles-ansible/check-ansible-ubuntu-bionic-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,16 +0,0 @@
name: Ansible check ubuntu:eoan
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ansible check with ubuntu:eoan
uses: roles-ansible/check-ansible-ubuntu-eoan-action@master
with:
targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check ubuntu:latest name: Ansible check ubuntu:latest
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with ubuntu:latest - name: ansible check with ubuntu:latest
uses: roles-ansible/check-ansible-ubuntu-latest-action@master uses: roles-ansible/check-ansible-ubuntu-latest-action@master
with: with:
targets: "./" targets: "./"

View file

@ -1,5 +1,7 @@
---
name: Ansible check ubuntu:trusty name: Ansible check ubuntu:trusty
# yamllint disable-line rule:truthy
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
@ -8,9 +10,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: ansible check with ubuntu:trusty - name: ansible check with ubuntu:trusty
uses: roles-ansible/check-ansible-ubuntu-trusty-action@master uses: roles-ansible/check-ansible-ubuntu-trusty-action@master
with: with:
targets: "./" targets: "./"

20
.github/workflows/galaxy.yml vendored Normal file
View file

@ -0,0 +1,20 @@
---
name: Galaxy release
# yamllint disable-line rule:truthy
on:
push:
branches: ['main']
release:
types: ['created']
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: galaxy
uses: robertdebock/galaxy-action@1.1.0
with:
galaxy_api_key: ${{ secrets.galaxy_api_key }}

24
.github/workflows/yamllint.yaml vendored Normal file
View file

@ -0,0 +1,24 @@
---
name: 'Yamllint GitHub Actions'
# yamllint disable-line rule:truthy
on:
push:
branches: '*'
pull_request:
branches: '*'
schedule:
- cron: '23 6 * */1 *'
jobs:
yamllint:
name: 'Yamllint'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master
- name: 'Yamllint'
uses: karancode/yamllint-github-action@master
with:
yamllint_file_or_dir: '.'
yamllint_config_filepath: './.yamllint'

View file

@ -1,29 +0,0 @@
---
# OS Details
os: linux
language: python
python: '3.8'
cache:
pip: true
# Install ansible and ansible-lint
install:
- pip install ansible
- pip install ansible-lint
# testing galaxy install and ansible lint
# more advanced testing is currently handled with
# github actions. The gh-actions for our test are there:
# https://github.com/roles-ansible and are tagged
# with 'github-actions' --> https://github.com/search?q=topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories
script:
- ansible-galaxy install do1jlr.ranger
- ansible-lint .
- echo -e "\n\n\n\n\nWe use github actions for more detailed tests.\n\nMore details about that in our github repo at:\nhttps://github.com/chaos-bodensee/role-weechat/actions\n\n\n\n\n\n"
notifications:
email:
on_success: never
on_failure: always
webhooks: https://galaxy.ansible.com/api/v1/notifications/

8
.yamllint Normal file
View file

@ -0,0 +1,8 @@
---
extends: default
rules:
# 160 chars should be enough, but don't fail if a line is longer
line-length:
max: 160
level: warning

View file

@ -1,7 +1,7 @@
--- ---
- name: systemctl restart weechat.service - name: systemctl restart weechat.service
become: true become: true
systemd: ansible.builtin.systemd:
state: restarted state: restarted
name: weechat.service name: weechat.service
daemon_reload: yes daemon_reload: true

View file

@ -1,24 +1,21 @@
--- ---
dependencies: []
galaxy_info: galaxy_info:
author: L3D role_name: weechat
description: Install WeeChat author: do1jlr
license: "license (MIT)" description: Install and optional configure weechat via ansible
license: "MIT"
min_ansible_version: 2.11
github_branch: main
platforms: platforms:
- name: Archlinux
versions: all
- name: Debian - name: Debian
versions: versions: all
- all
- name: ArchLinux
versions:
- all
- name: Fedora
versions:
- all
- name: Ubuntu - name: Ubuntu
versions: versions: all
- all - name: Fedora
min_ansible_version: 2.8 versions: all
galaxy_tags: galaxy_tags:
- system
- weechat - weechat
- irc
dependencies: []

View file

@ -2,7 +2,7 @@
- name: create ssh key pair (if needed) - name: create ssh key pair (if needed)
become_user: "{{ weechat.user }}" become_user: "{{ weechat.user }}"
become: true become: true
openssh_keypair: community.cryptop.openssh_keypair:
path: "{{ weechat.home_directory }}/.ssh/id_ed25519" path: "{{ weechat.home_directory }}/.ssh/id_ed25519"
type: ed25519 type: ed25519
owner: "{{ weechat.user }}" owner: "{{ weechat.user }}"
@ -10,7 +10,7 @@
when: weechat.custom_config.gen_ssh_key_pair | bool when: weechat.custom_config.gen_ssh_key_pair | bool
- name: print ssh public key to user - name: print ssh public key to user
pause: ansible.builtin.pause:
prompt: | prompt: |
We generated a new ssh key pair for you. We generated a new ssh key pair for you.
Please use the following public key as deployment key Please use the following public key as deployment key
@ -38,22 +38,22 @@
become: true become: true
block: block:
- name: try to download/update git repo - name: try to download/update git repo
git: ansible.builtin.git:
repo: "{{ weechat.custom_config.private_repo }}" repo: "{{ weechat.custom_config.private_repo }}"
dest: "{{ weechat.home_directory }}/.weechat" dest: "{{ weechat.home_directory }}/.weechat"
version: master version: master
accept_hostkey: yes accept_hostkey: true
update: yes update: true
rescue: rescue:
- name: wait until you fixed remote git issues - name: wait until you fixed remote git issues
pause: pause:
prompt: "Please fix the issue with your git repository and try again" 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
git: ansible.builtin.git:
repo: "{{ weechat.custom_config.private_repo }}" repo: "{{ weechat.custom_config.private_repo }}"
dest: "{{ weechat.home_directory }}/.weechat" dest: "{{ weechat.home_directory }}/.weechat"
version: master version: master
accept_hostkey: yes accept_hostkey: true
update: yes update: true
when: not weechat.custom_config.private_repo | bool when: not weechat.custom_config.private_repo | bool

View file

@ -1,6 +1,7 @@
--- ---
- name: install weechat if available - name: install weechat if available
package: become: true
ansible.builtin.package:
name: name:
- weechat - weechat
state: present state: present

View file

@ -1,34 +1,34 @@
--- ---
- name: install apt-transport-https - name: install apt-transport-https
become: true become: true
apt: ansible.builtin.apt:
name: apt-transport-https name: apt-transport-https
state: present state: present
- name: Add weechat repository gpg-key - name: Add weechat repository gpg-key
become: true become: true
apt_key: ansible.builtin.apt_key:
keyserver: 'keys.openpgp.org' keyserver: 'keys.openpgp.org'
id: "{{ weechat.gpg_id }}" id: "{{ weechat.gpg_id }}"
state: present state: present
- name: add weechat repo - name: add weechat repo
become: true become: true
apt_repository: ansible.builtin.apt_repository:
repo: "deb {{ weechat__debian_weechat_repo }}" repo: "deb {{ weechat__debian_weechat_repo }}"
state: present state: present
update_cache: true update_cache: true
- name: add weechat repo-src - name: add weechat repo-src
become: true become: true
apt_repository: ansible.builtin.apt_repository:
repo: "deb-src {{ weechat__debian_weechat_repo }}" repo: "deb-src {{ weechat__debian_weechat_repo }}"
state: present state: present
update_cache: true update_cache: true
- name: install recomended weechat packages - name: install recomended weechat packages
become: true become: true
apt: ansible.builtin.apt:
name: name:
- weechat-curses - weechat-curses
- weechat-plugins - weechat-plugins

View file

@ -1,6 +1,7 @@
--- ---
- name: install weechat if available - name: install weechat if available
package: become: true
ansible.builtin.package:
name: name:
- weechat - weechat
state: present state: present

View file

@ -3,17 +3,22 @@
set_fact: set_fact:
weechat: "{{ _weechat | combine(weechat, recursive=True) }}" weechat: "{{ _weechat | combine(weechat, recursive=True) }}"
- include_tasks: versioncheck.yml - name: perform optinal versionscheck
ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck|bool when: submodules_versioncheck|bool
- 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 when: weechat.install | bool
- include_tasks: configure_custom_config.yml - name: deploy weechat configuration
ansible.builtin.include_tasks: configure_custom_config.yml
when: weechat.use_custom_config | bool when: weechat.use_custom_config | bool
- include_tasks: configure_plugins.yml - name: install requirements for weechat plugins
ansible.builtin.include_tasks: configure_plugins.yml
when: weechat.install_plugins | bool when: weechat.install_plugins | bool
- include_tasks: setup_autostart.yml - name: setup weechat autostart
ansible.builtin.include_tasks: setup_autostart.yml
when: weechat.autostart | bool when: weechat.autostart | bool

View file

@ -1,14 +1,14 @@
--- ---
- name: install tmux to launch weechat - name: install tmux to launch weechat
become: true become: true
package: ansible.builtin.package:
name: tmux name: tmux
state: present state: present
when: weechat.install | bool when: weechat.install | bool
- name: copy systemd service for weechat - name: copy systemd service for weechat
become: true become: true
template: ansible.builtin.template:
src: templates/weechat.service src: templates/weechat.service
dest: /etc/systemd/system/weechat.service dest: /etc/systemd/system/weechat.service
owner: root owner: root
@ -18,7 +18,7 @@
- name: enable weechat.service - name: enable weechat.service
become: true become: true
systemd: ansible.builtin.systemd:
enabled: true enabled: true
state: started state: started
name: weechat.service name: weechat.service

View file

@ -1,7 +1,10 @@
--- ---
# Copyright (c) 2021 L3D <l3d@c3woc.de>
# this file is released with the MIT license.
# License: https://github.com/roles-ansible/ansible_role_template/blob/main/LICENSE
- name: Create directory for versionscheck - name: Create directory for versionscheck
become: true become: true
file: ansible.builtin.file:
path: '/etc/.ansible-version' path: '/etc/.ansible-version'
state: directory state: directory
mode: 0755 mode: 0755
@ -9,37 +12,32 @@
- name: check playbook version - name: check playbook version
become: true become: true
slurp: ansible.builtin.slurp:
src: "/etc/.ansible-version/{{ playbook_version_path }}" src: "/etc/.ansible-version/{{ playbook_version_path }}"
register: playbook_version register: playbook_version
when: submodules_versioncheck|bool when: submodules_versioncheck|bool
ignore_errors: yes ignore_errors: true
failed_when: false failed_when: false
- name: Print remote role version - name: Print remote role version
debug: ansible.builtin.debug:
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" msg: "Remote role version: {{ 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
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
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 - playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
- name: check if '/etc/ansible-version/' is empty
find:
paths: '/etc/ansible-version/'
register: filesFound
- name: write new version to remote disk - name: write new version to remote disk
become: true become: true
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'

View file

@ -9,7 +9,7 @@ weechat_plugin_languages:
lua: lua lua: lua
# version management # version management
playbook_version_number: 4099 # should be over ninethousand playbook_version_number: 4199 # should be over ninethousand
playbook_version_path: 'role-weechat_roles-ansible_github.com.version' playbook_version_path: 'role-weechat_roles-ansible_github.com.version'
# default values # default values