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

Merge pull request #1 from chaos-bodensee/custom

enable support for custom config git + DOCS
This commit is contained in:
L3D 2020-03-12 23:07:25 +01:00 committed by GitHub
commit 4b081fd32b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 161 additions and 12 deletions

View file

@ -11,6 +11,86 @@ Ansible role to install and configure weechat.
- ~~configure weechat~~ *(in progress)*
- autostart via tmux and systemd
Settings
----------
```yaml
weechat:
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: false``: We do not install weechat
```yaml
weechat:
autostart: false
```
+ ``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 }}``
```yaml
weechat:
install_plugins: false
```
+ ``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.
```yaml
weechat:
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: true``: You have your weechat configuration in a own git repository and want to use it
```yaml
weechat:
install_plugins: false
```
+ ``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.
```yaml
weechat:
plugins:
- go.py
- iset.pl
```
+ Example ``weechat.plugins: []`` list
```yaml
weechat:
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
```yaml
weechat:
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.
```yaml
weechat:
gpg_id: '11E9DE8848F2B65222AA75B8D1820DB22A11534E'
```
+ This is the gpg fingerprint from the [official weechat debian repo](https://weechat.org/download/debian/)
```yaml
weechat:
custom_config:
private_repo: false
```
+ 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.
+ 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
weechat:
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_config.gen_ssh_key_pair: false``: We do not manage access to the git repo with your weechat config.
```txt
WARNING
@ -18,14 +98,24 @@ WARNING
It is work-in-progress. Be careful!
MISSING
- task for configurations
- all task for configurations
- testing for all OS
- docs
- improved docs
- galaxy
```
References and Inspiration:
----------------------
+ Information about installation on debian/ubuntu can be found at [weechat.org/download/debian](https://weechat.org/download/debian/)
+ Some parts of the Weechat configuration is inspired by [github.com/irth/ansible-role-weechat](https://github.com/irth/ansible-role-weechat.git) but written in a complete different way.
+ Some parts of the Weechat configuration is inspired by [github.com/irth/ansible-role-weechat](https://github.com/irth/ansible-role-weechat.git) but written in a complete different way. Some other is completly different.
+ Autostart and systemd is inspired by [ubuntu wiki](https://wiki.ubuntuusers.de/Howto/systemd_Service_Unit_Beispiel/) and [ansible docs](https://docs.ansible.com/ansible/latest/modules/systemd_module.html).
Contribute
------------
If you missing a feature, found a bug or have questions about this role please feel free to open a git issue. Or - even better - create a pull request.
LICENSE
----------
[MIT License](https://github.com/chaos-bodensee/role_weechat/blob/master/LICENSE)<br/>
+ ``Copyright (c) 2019 L3D``
+ The complete list of awesome contributros can be found [here](https://github.com/chaos-bodensee/role_weechat/graphs/contributors).

View file

@ -6,15 +6,22 @@ weechat:
autostart: false
# should we install official weechat plugins
install_plugins: false
# custom weechat config (requires some manual interaction for long-term usage)
use_custom_config: false
# user to install and use weechat
user: "{{ ansible_user_id }}"
# 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: []
# weechat gpg key for debian/ubuntu repo
gpg_id: '11E9DE8848F2B65222AA75B8D1820DB22A11534E'
# custom private config
custom_config:
# path to your custom weechat config (with plugins) git repo ( git@github.com:<your_name>/<your_weechat_config_repo>.git )
private_repo: false
# generate ssh key pair (if not available)
gen_ssh_key_pair: true
# version check for this role? (true is recomended)
submodules_versioncheck: false

View file

@ -0,0 +1,44 @@
---
- name: create ssh key pair (if needed)
become_user: "{{ weechat.user }}"
become: true
openssh_keypair:
path: "{{ weechat.home_directory }}/.ssh/id_ed25519"
type: ed25519
owner: "{{ weechat.user }}"
register: ssh_key_pair
when: weechat.custom_config.gen_ssh_key_pair | bool
- name: print ssh public key to user
pause:
prompt: |
We generated a new ssh key pair for you.
Please use the following public key as deployment key
to your private git repository with your own weechat config.
Private git repositorys are not public available and
you need some sort of authorisation method to verify
that you are allowed to clone your private repo.
Your ssh public key come here...
{{ ssh_key_pair.public_key }}
Please be aware, that this role do not commit or
push any local changes and you have to do this
manually by yourself.
when:
- weechat.custom_config.gen_ssh_key_pair | bool
- ssh_key_pair.changed
- name: clone private git repository
become_user: "{{ weechat.user }}"
become: true
git:
repo: "{{ weechat.custom_config.private_repo }}"
dest: "{{ weechat.home_directory }}/.weechat"
version: master
accept_hostkey: yes
when: not weechat.custom_config.private_repo | bool

View file

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

@ -9,6 +9,9 @@
- include_tasks: "install-{{ ansible_os_family|lower }}.yml"
when: weechat.install | bool
- include_tasks: configure_custom_config.yml
when: weechat.use_custom_config | bool
- include_tasks: configure_plugins.yml
when: weechat.install_plugins | bool

View file

@ -9,7 +9,7 @@ weechat_plugin_languages:
lua: lua
# version management
playbook_version_number: 2055 # should be over ninethousand
playbook_version_number: 2056 # should be over ninethousand
playbook_version_path: 'role-weechat_roles-ansible_github.com.version'
# default values
@ -18,6 +18,11 @@ _weechat:
autostart: false
install_plugins: false
user: "{{ ansible_user_id }}"
home_directory: "{{ ansible_env.HOME | default('/home/{{ weechat.user }}') }}/.weechat"
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