nginx_logsync: Initial version of role
This commit is contained in:
parent
af5655e131
commit
b6131534f6
1 changed files with 34 additions and 0 deletions
34
roles/nginx_logsync/tasks/main.yml
Normal file
34
roles/nginx_logsync/tasks/main.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
- name: Create group
|
||||||
|
ansible.builtin.group:
|
||||||
|
name: logsync
|
||||||
|
system: true
|
||||||
|
|
||||||
|
- name: Create user
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: logsync
|
||||||
|
comment: Service logsync
|
||||||
|
create_home: false
|
||||||
|
group: logsync
|
||||||
|
home: /var/empty
|
||||||
|
shell: /sbin/nologin
|
||||||
|
|
||||||
|
- name: Create authorized_keys
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /etc/ssh/authorized_keys.logsync
|
||||||
|
src: ../files/ssh/logsync.pub
|
||||||
|
mode: "0640"
|
||||||
|
owner: root
|
||||||
|
group: logsync
|
||||||
|
|
||||||
|
- name: Configure sshd chroot
|
||||||
|
ansible.builtin.blockinfile:
|
||||||
|
path: /etc/ssh/sshd_config
|
||||||
|
block: |
|
||||||
|
Match User logsync
|
||||||
|
ChrootDirectory /var/www/logs
|
||||||
|
ForceCommand internal-sftp
|
||||||
|
AuthorizedKeysFile /etc/ssh/authorized_keys.logsync
|
||||||
|
marker: "# {mark} ANSIBLE MANAGED BLOCK (user logsync)"
|
||||||
|
validate: "sshd -t -f %s"
|
||||||
|
notify: Restart sshd
|
Loading…
Add table
Reference in a new issue