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

create autorun via tmux

This commit is contained in:
L3D 2020-03-11 10:42:48 +01:00 committed by L3D
parent 2338f51cbf
commit 3d5f693879
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B
5 changed files with 43 additions and 3 deletions

View file

@ -2,8 +2,10 @@
weechat:
# should we install weechat?
install: true
# autostart weechat via systemd in a tmux session?
autostart: true
# should we configure weechat
configure: true
configure: false
# user to install and use weechat
user: "{{ ansible_user_id }}"
# where is our home direcotory for weechat

11
files/weechat.service Normal file
View file

@ -0,0 +1,11 @@
[Unit]
Description=Weechat Chat Client
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/tmux -2 new-session -d -s weechat /usr/bin/weechat
ExecStop=/usr/bin/tmux kill-session -t weechat
[Install]
WantedBy=network.target

View file

@ -11,3 +11,6 @@
#- include_tasks: plugins.yml
# when: configure_weechat | bool
- include_tasks: setup_autostart.yml
when: weechat.autostart | bool

23
tasks/setup_autostart.yml Normal file
View file

@ -0,0 +1,23 @@
---
- name: install tmux to launch weechat
become: true
package:
name: tmux
state: present
when: weechat.install | bool
- name: copy systemd service for weechat
become: true
copy:
src: files/weechat.service
dest: /etc/systemd/system/weechat.service
owner: root
group: root
mode: '0644'
- name: start and enable weechat.service
become: true
systemd:
state: started
name: weechat.service
daemon_reload: yes

View file

@ -9,13 +9,14 @@ weechat_plugin_languages:
lua: lua
# version management
playbook_version_number: 2050 # should be over ninethousand
playbook_version_number: 2051 # should be over ninethousand
playbook_version_path: 'role-weechat_roles-ansible_github.com.version'
# default values
_weechat:
install: true
configure: true
autostart: true
configure: false
user: "{{ ansible_user_id }}"
home_directory: "/home/{{ weechat_user }}/.weechat"
plugins: []