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

change config

This commit is contained in:
L3D 2021-05-27 16:18:04 +02:00
parent fbfeeec69e
commit 54caea0e80
Signed by: l3d
GPG key ID: CD08445BFF4313D1
9 changed files with 87 additions and 137 deletions

View file

@ -17,82 +17,74 @@ Ansible role to install and configure weechat.
---------- ----------
```yaml ```yaml
weechat: weechat__install: true
install: true
``` ```
+ ``weechat.install: true``: This role should install weechat. On debian based OS we add the official weechat apt source and install some plugin support and weechat-doc. + ``weechat__install: true``: This role should install weechat. On debian based OS we add the official weechat apt source and install some plugin support and weechat-doc.
+ ``weechat.install: false``: We do not install weechat + ``weechat__install: false``: We do not install weechat
```yaml ```yaml
weechat: weechat__autostart: false
autostart: false
``` ```
+ ``weechat.autostart: false``: We do not install any autostart mechanism + ``weechat__autostart: false``: We do not install any autostart mechanism
+ ``weechat.autostart: true``: This role install tmux and creates a systemd service to launch weechat inside a tmux session as user ``{{ weechat.user }}`` + ``weechat__autostart: true``: This role install tmux and creates a systemd service to launch weechat inside a tmux session as user ``{{ weechat__user }}``
```yaml ```yaml
weechat: weechat__install_plugins: false
install_plugins: false
``` ```
+ ``weechat.install_plugins: false``: we do not install any weechat plugins + ``weechat__install_plugins: false``: we do not install any weechat plugins
+ ``weechat.install_plugins: true``: We do install all official plugins specified in ``{{ weecat.plugins }}`` dict. + ``weechat__install_plugins: true``: We do install all official plugins specified in ``{{ weecat.plugins }}`` dict.
```yaml ```yaml
weechat: weechat__use_custom_config: false
use_custom_config: false
``` ```
+ ``weechat.use_custom_config: false``: You do not provide a custom config from your own git repository + ``weechat__use_custom_config: false``: You do not provide a custom config from your own git repository
+ ``weechat.use_custom_config: true``: You have your weechat configuration in a own git repository and want to use it + ``weechat__use_custom_config: true``: You have your weechat configuration in a own git repository and want to use it
```yaml ```yaml
weechat: weechat__install_plugins: false
install_plugins: false
``` ```
+ ``weechat.install_plugins: false`` we do not install any official weechat plugins + ``weechat__install_plugins: false`` we do not install any official weechat plugins
+ ``weechat.install_plugins: true`` we install the official weechat plugins defined in the ``{{ weechat.plugins: [] }}`` directory. + ``weechat__install_plugins: true`` we install the official weechat plugins defined in the ``{{ weechat__plugins: [] }}`` directory.
```yaml ```yaml
weechat: weechat__plugins:
plugins:
- go.py - go.py
- iset.pl - iset.pl
``` ```
+ Example ``weechat.plugins: []`` list + Example ``weechat__plugins: []`` list
```yaml ```yaml
weechat: weechat__user: "{{ ansible_user_id }}"
user: "{{ ansible_user_id }}"
``` ```
+ the user to use weechat with. This value is used in the ``autostart`` task, the ``custom_config`` task and the ``{{ weechat.home_directory }}`` variable + the user to use weechat with. This value is used in the ``autostart`` task, the ``custom_config`` task and the ``{{ weechat__home_directory }}`` variable
```yaml ```yaml
weechat: weechat__home_directory: "{{ ansible_env.HOME | default('/home/{{ weechat__user }}') }}"
home_directory: "{{ ansible_env.HOME | default('/home/{{ weechat.user }}') }}"
``` ```
+ the path where the weechat home is located. If the variable ``{{ ansible_env.HOME }}`` is not set it will use ``"/home/{{ weechat.user }}"`` as fallback. + the path where the weechat home is located. If the variable ``{{ ansible_env.HOME }}`` is not set it will use ``"/home/{{ weechat__user }}"`` as fallback.
```yaml ```yaml
weechat: weechat__gpg_id: '11E9DE8848F2B65222AA75B8D1820DB22A11534E'
gpg_id: '11E9DE8848F2B65222AA75B8D1820DB22A11534E'
``` ```
+ This is the gpg fingerprint from the [official weechat debian repo](https://weechat.org/download/debian/) + This is the gpg fingerprint from the [official weechat debian repo](https://weechat.org/download/debian/)
```yaml ```yaml
weechat: weechat__custom_private_repo: false
custom_config:
private_repo: false
``` ```
+ The path to your git repo with your personal weechat config. + The path to your git repo with your personal weechat config.
+ This role clones the repo to the ``"{{ weechat.home_directory }}/.weechat"`` directory. *(Also known al your local .weechat directory.)* It will fail if you already have files and/or folders in your local .weechat dorectory. + This role clones the repo to the ``"{{ weechat__home_directory }}/.weechat"`` directory. *(Also known al your local .weechat directory.)* It will fail if you already have files and/or folders in your local .weechat dorectory.
+ You have to add, commit and push the local changes in your local .weechat folder manually. Please be aware that it is a good idea to disable your log or at least add the weechatlog folder to your .gitignore file in your personal weechat config. + You have to add, commit and push the local changes in your local .weechat folder manually. Please be aware that it is a good idea to disable your log or at least add the weechatlog folder to your .gitignore file in your personal weechat config.
```yaml ```yaml
weechat: weechat__custom_gen_ssh_key_pair: true
custom_config:
gen_ssh_key_pair: true
``` ```
+ ``weechat.custom_config.gen_ssh_key_pair: true``: We will generate a eleptic curve ssh key *(if it not already exist at ``"{{ weechat.home_directory }}/.ssh/id_ed25519"``)* and print the public key to the prompt. This will give you the time to add this public key to your private git repo for your own weechat config as deploy key. This is required to download your private repo withour username/password. This requires that you set ``{{ weechat.custom_config.private_repo }}`` to the ssh accessable version of your git repo. + ``weechat__custom_gen_ssh_key_pair: true``: We will generate a eleptic curve ssh key *(if it not already exist at ``"{{ weechat__home_directory }}/.ssh/id_ed25519"``)* and print the public key to the prompt. This will give you the time to add this public key to your private git repo for your own weechat config as deploy key. This is required to download your private repo withour username/password. This requires that you set ``{{ weechat__custom_private_repo }}`` to the ssh accessable version of your git repo.
+ ``weechat.custom_config.gen_ssh_key_pair: false``: We do not manage access to the git repo with your weechat config. + ``weechat__custom_gen_ssh_key_pair: false``: We do not manage access to the git repo with your weechat config.
```yaml
weechat__custom_version: main
```
+ ``weechat__custom_version: main``: set the git branch, tag, hash or version this role should use if you use a custom git repo for your weechat config.
```txt ```txt
WARNING WARNING
@ -127,26 +119,4 @@ If you missing a feature, found a bug or have questions about this role please f
This role is tested with [these github-action](https://github.com/search?q=topic%3Acheck-ansible+topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories) tests for different versions of differen linux systems. Linting is tested via travis-ci and the [ansible-lint action](https://github.com/marketplace/actions/ansible-lint). This role is tested with [these github-action](https://github.com/search?q=topic%3Acheck-ansible+topic%3Agithub-actions+org%3Aroles-ansible&type=Repositories) tests for different versions of differen linux systems. Linting is tested via travis-ci and the [ansible-lint action](https://github.com/marketplace/actions/ansible-lint).
If you want to find out more about our tests, please have a look at the github marketplace. If you want to find out more about our tests, please have a look at the github marketplace.
| test status | Github Marketplace |
| :--------- | :---------------- |
| [![Travis Build Status](https://travis-ci.org/chaos-bodensee/role_weechat.svg?branch=master)](https://travis-ci.org/chaos-bodensee/role_weechat) | [.travis.yml](https://github.com/chaos-bodensee/role_weechat/blob/master/.travis.yml) |
|||
| [![Ansible Lint check](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20Lint%20check/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+Lint+check%22) | [ansible-lint action](https://github.com/marketplace/actions/ansible-lint)
| [![Ansible check debian:stable](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20debian:stable/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+debian%3Astable%22) | [ansible test with debian stable](https://github.com/marketplace/actions/check-ansible-debian-stable) |
| [![Ansible check debian:latest](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20debian:latest/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+debian%3Alatest%22) | [ansible test with debian latest](https://github.com/marketplace/actions/check-ansible-debian-latest) |
| [![Ansible check debian:sid](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20debian:sid/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+debian%3Asid%22) | [ansible test with debian sid](https://github.com/marketplace/actions/check-ansible-debian-sid) |
| [![Ansible check debian:buster](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20debian:buster/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+debian%3Abuster%22) | [ansible test with debian buster](https://github.com/marketplace/actions/check-ansible-debian-buster) |
| [![Ansible check debian:stretch](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20debian:stretch/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+debian%3Astretch%22) | [ansible test with debian stretch](https://github.com/marketplace/actions/check-ansible-debian-stretch) |
| | |
| [![Ansible check archlinux:latest](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20archlinux:latest/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+archlinux%3Alatest%22) | [ansible test with archlinux latest](https://github.com/marketplace/actions/check-ansible-archlinux-latest) |
| | |
| [![Ansible check ubuntu:latest](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20ubuntu:latest/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+ubuntu%3Alatest%22) | [ansible test with ubuntu latest](https://github.com/marketplace/actions/check-ansible-ubuntu-latest) |
| [![Ansible check ubuntu:bionic](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20ubuntu:bionic/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+ubuntu%3Abionic%22) | [ansible test with ubuntu bionic](https://github.com/marketplace/actions/check-ansible-ubuntu-bionic) |
| [![Ansible check ubuntu:eoan](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20ubuntu:eoan/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+ubuntu%3Aeoan%22) | [ansible test with ubuntu eoan](https://github.com/marketplace/actions/check-ansible-ubuntu-eoan) |
| [![Ansible check ubuntu:trusty](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20ubuntu:trusty/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+ubuntu%3Atrusty%22) | [ansible test with ubuntu trusty](https://github.com/marketplace/actions/check-ansible-ubuntu-trusty) |
| | |
| [![Ansible check fedora:latest](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20fedora:latest/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+fedora%3Alatest%22) | [ansible test with fedora latest](https://github.com/marketplace/actions/check-ansible-fedora-latest) |
| [![Ansible check fedora:33](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20fedora:33/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+fedora%3A33%22) | [ansible test with fedora 33](https://github.com/marketplace/actions/check-ansible-fedora-33) |
| [![Ansible check fedora:32](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20fedora:32/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+fedora%3A32%22) | [ansible test with fedora 32](https://github.com/marketplace/actions/check-ansible-fedora-32) |
| [![Ansible check fedora:31](https://github.com/chaos-bodensee/role_weechat/workflows/Ansible%20check%20fedora:31/badge.svg)](https://github.com/chaos-bodensee/role_weechat/actions?query=workflow%3A%22Ansible+check+fedora%3A31%22) | [ansible test with fedora 31](https://github.com/marketplace/actions/check-ansible-fedora-31) |

View file

@ -1,30 +1,28 @@
--- ---
weechat:
# should we install weechat? # should we install weechat?
install: true weechat__install: true
# autostart weechat via systemd in a tmux session? # autostart weechat via systemd in a tmux session?
autostart: false weechat__autostart: false
# should we install official weechat plugins # should we install official weechat plugins
install_plugins: false weechat__install_plugins: false
# custom weechat config (requires some manual interaction for long-term usage) # custom weechat config (requires some manual interaction for long-term usage)
use_custom_config: false weechat__use_custom_config: false
# user to install and use weechat # user to install and use weechat
user: "{{ ansible_user_id }}" weechat__user: "{{ ansible_user_id }}"
# where is our home direcotory for weechat # where is our home direcotory for weechat
home_directory: "{{ ansible_env.HOME | default('/home/{{ weechat.user }}') }}" weechat__home_directory: "{{ ansible_env.HOME | default('/home/{{ weechat__user }}') }}"
# plugins we want # plugins we want
plugins: [] weechat__plugins: []
# weechat gpg key for debian/ubuntu repo # weechat gpg key for debian/ubuntu repo
gpg_id: '11E9DE8848F2B65222AA75B8D1820DB22A11534E' weechat__gpg_id: '11E9DE8848F2B65222AA75B8D1820DB22A11534E'
# custom private config
custom_config: # path to your custom weechat config (with plugins) git repo
# path to your custom weechat config (with plugins) git repo # ( eg. git@github.com:<your_name>/<your_weechat_config_repo>.git )
# ( eg. git@github.com:<your_name>/<your_weechat_config_repo>.git ) weechat__custom_private_repo: false
private_repo: false # generate ssh key pair (if not available)
# generate ssh key pair (if not available) weechat__custom_gen_ssh_key_pair: true
gen_ssh_key_pair: true # the tag, commit or branch we should check out
# the tag, commit or branch we should check out weechat__custom_version: 'main'
version: 'main'
# version check for this role? (true is recomended) # version check for this role? (true is recomended)
submodules_versioncheck: false submodules_versioncheck: false

View file

@ -2,11 +2,11 @@
- name: create ssh key pair (if needed) - name: create ssh key pair (if needed)
become: true become: true
community.crypto.openssh_keypair: community.crypto.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 }}"
register: ssh_key_pair register: ssh_key_pair
when: weechat.custom_config.gen_ssh_key_pair | bool 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: ansible.builtin.pause:
@ -29,7 +29,7 @@
push any local changes and you have to do this push any local changes and you have to do this
manually by yourself. manually by yourself.
when: when:
- weechat.custom_config.gen_ssh_key_pair | bool - weechat__custom_config.gen_ssh_key_pair | bool
- ssh_key_pair.changed - ssh_key_pair.changed
- name: clone or update private git repository - name: clone or update private git repository
@ -37,12 +37,12 @@
block: block:
- name: try to download/update git repo - name: try to download/update git repo
ansible.builtin.git: ansible.builtin.git:
repo: "{{ weechat.custom_config.private_repo }}" repo: "{{ weechat__custom_private_repo }}"
dest: "{{ weechat.home_directory }}/.weechat" dest: "{{ weechat__home_directory }}/.weechat"
version: "{{ weechat.custom_config.version | default ('main') }}" version: "{{ weechat__custom_config.version | default ('main') }}"
accept_hostkey: true accept_hostkey: true
update: true update: true
ssh_opts: "-i {{ weechat.home_directory }}/.ssh/id_ed25519" ssh_opts: "-i {{ weechat__home_directory }}/.ssh/id_ed25519"
rescue: rescue:
- name: wait until you fixed remote git issues - name: wait until you fixed remote git issues
pause: pause:
@ -50,18 +50,18 @@
- name: try to download/update git repo again - name: try to download/update git repo again
ansible.builtin.git: ansible.builtin.git:
repo: "{{ weechat.custom_config.private_repo }}" repo: "{{ weechat__custom_private_repo }}"
dest: "{{ weechat.home_directory }}/.weechat" dest: "{{ weechat__home_directory }}/.weechat"
version: master version: "{{ weechat__custom_config.version | default ('main') }}"
accept_hostkey: true accept_hostkey: true
update: true update: true
ssh_opts: "-i {{ weechat.home_directory }}/.ssh/id_ed25519" ssh_opts: "-i {{ weechat__home_directory }}/.ssh/id_ed25519"
when: not weechat.custom_config.private_repo | bool when: not weechat__custom_private_repo | bool
- name: "change git repo ownwe to {{ weechat.user }}" - name: "change git repo ownwe to {{ weechat__user }}"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ weechat.home_directory }}/.weechat" path: "{{ weechat__home_directory }}/.weechat"
recurse: true recurse: true
owner: "{{ weechat.user }}" owner: "{{ weechat__user }}"
when: not weechat.custom_config.private_repo | bool when: not weechat__custom_private_repo | bool

View file

@ -2,29 +2,29 @@
- name: create weechat directory - name: create weechat directory
become: true become: true
file: file:
path: "{{ weechat.home_directory }}/.weechat" path: "{{ weechat__home_directory }}/.weechat"
state: directory state: directory
owner: "{{ weechat.user }}" owner: "{{ weechat__user }}"
mode: "0750" mode: "0750"
- name: create weechat plugins directory - name: create weechat plugins directory
become: true become: true
file: file:
path: "{{ weechat.home_directory }}/.weechat/{{ item.value }}/autoload" path: "{{ weechat__home_directory }}/.weechat/{{ item.value }}/autoload"
state: directory state: directory
owner: "{{ weechat.user }}" owner: "{{ weechat__user }}"
mode: "0750" mode: "0750"
with_dict: "{{ weechat_plugin_languages }}" with_dict: "{{ weechat_plugin_languages }}"
- name: download weechat plugins - name: download weechat plugins
get_url: get_url:
url: 'https://weechat.org/files/scripts/{{ item }}' 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 }}"
with_items: '{{ weechat.plugins }}' with_items: '{{ weechat__plugins }}'
- name: symlinking plugins to autoload - name: symlinking plugins to autoload
file: file:
src: "{{ weechat.home_directory }}/.weechat/{{ weechat_plugin_languages[item.split('.',1)[-1]] }}/{{ 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 }}" dest: "{{ weechat__home_directory }}/.weechat/{{ weechat_plugin_languages[item.split('.',1)[-1]] }}/autoload/{{ item }}"
state: link state: link
with_items: '{{ weechat.plugins }}' with_items: '{{ weechat__plugins }}'

View file

@ -9,7 +9,7 @@
become: true become: true
ansible.builtin.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

View file

@ -1,24 +1,20 @@
--- ---
- name: combine weechat variables
set_fact:
weechat: "{{ _weechat | combine(weechat, recursive=True) }}"
- name: perform optinal versionscheck - name: perform optinal versionscheck
ansible.builtin.include_tasks: versioncheck.yml ansible.builtin.include_tasks: versioncheck.yml
when: submodules_versioncheck|bool when: submodules_versioncheck|bool
- name: install weechat - name: install weechat
ansible.builtin.include_tasks: "install-{{ ansible_os_family|lower }}.yml" ansible.builtin.include_tasks: "install-{{ ansible_os_family|lower }}.yml"
when: weechat.install | bool when: weechat__install | bool
- name: deploy weechat configuration - name: deploy weechat__configuration
ansible.builtin.include_tasks: configure_custom_config.yml ansible.builtin.include_tasks: configure_custom_config.yml
when: weechat.use_custom_config | bool 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 ansible.builtin.include_tasks: configure_plugins.yml
when: weechat.install_plugins | bool when: weechat__install_plugins | bool
- name: setup weechat autostart - name: setup weechat__autostart
ansible.builtin.include_tasks: setup_autostart.yml ansible.builtin.include_tasks: setup_autostart.yml
when: weechat.autostart | bool when: weechat__autostart | bool

View file

@ -4,7 +4,7 @@
ansible.builtin.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

View file

@ -2,7 +2,7 @@
Description=Weechat Chat Client Description=Weechat Chat Client
[Service] [Service]
User={{ weechat.user }} User={{ weechat__user }}
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=/usr/bin/tmux -2 new-session -d -s weechat /usr/bin/weechat ExecStart=/usr/bin/tmux -2 new-session -d -s weechat /usr/bin/weechat

View file

@ -9,21 +9,7 @@ weechat_plugin_languages:
lua: lua lua: lua
# version management # version management
playbook_version_number: 4200 # should be over ninethousand playbook_version_number: 4220 # 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
_weechat:
install: true
autostart: false
install_plugins: false
user: "{{ ansible_user_id }}"
home_directory: "{{ ansible_env.HOME | default('/home/{{ weechat.user }}') }}"
plugins: []
gpg_id: '11E9DE8848F2B65222AA75B8D1820DB22A11534E'
use_custom_config: false
custom_config:
private_repo: false
gen_ssh_key_pair: true
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"