Move to template-in-playbook scheme

This commit is contained in:
Oleg "Zmey!" Vasiliev
2022-04-23 23:08:24 +03:00
parent d77f51aa5c
commit 76c59c4b85
5 changed files with 14 additions and 83 deletions

View File

@@ -1,52 +1,21 @@
#- block:
# - name: 3proxy | Install from aur
# aur:
# name: 3proxy
# use: makepkg
# skip_installed: yes
# become: no
---
#Creating group threeproxy with gid 973.
#Creating user threeproxy (3proxy user) with uid 973 and gid 973.
- name: 3proxy | Create group
group:
name: "{{ cfg_3proxy.group | default(cfg_3proxy_defaults.group) }}"
system: yes
- name: 3proxy | Create user
user:
name: "{{ cfg_3proxy.user | default(cfg_3proxy_defaults.user) }}"
group: "{{ cfg_3proxy.group | default(cfg_3proxy_defaults.group) }}"
shell: /usr/bin/nologin
system: yes
create_home: no
register: cfg_3proxy_user_info
#3proxy | Deploy configuration file...
# nyarlathotep.zeym.org failed | msg: Destination directory /etc/3proxy does not exist
- name: 3proxy | Install from aur
aur:
name: 3proxy
use: makepkg
skip_installed: yes
become: no
- name: 3proxy | Deploy configuration file
template:
src: 3proxy.cfg.j2
dest: /etc/3proxy/3proxy.cfg
mode: 0600
owner: "{{ cfg_3proxy.user | default(cfg_3proxy_defaults.user) }}"
group: "{{ cfg_3proxy.group | default(cfg_3proxy_defaults.group) }}"
owner: threeproxy
group: threeproxy
notify: 3proxy | Reload configuration
#### some hardening
#- name: 3proxy | Deploy systemd service override
# template:
# src: 3proxy.service.j2
# dest: /etc/systemd/system/...??? or /var/lib
# mode: 0600
# owner: root
# group: root
# notify:
# - 3proxy | Stop service
# - 3proxy | Start service
- name: 3proxy | Enable and start
systemd:
name: 3proxy