Create registrator role
This commit is contained in:
parent
168641b728
commit
04c7efe706
7 changed files with 174 additions and 0 deletions
122
roles/registrator/tasks/main.yml
Normal file
122
roles/registrator/tasks/main.yml
Normal file
|
@ -0,0 +1,122 @@
|
|||
- name: Create registrator group
|
||||
group:
|
||||
name: registrator
|
||||
system: yes
|
||||
|
||||
- name: Create registrator user
|
||||
user:
|
||||
name: registrator
|
||||
system: yes
|
||||
home: /home/registrator
|
||||
shell: /sbin/nologin
|
||||
generate_ssh_key: yes
|
||||
ssh_key_comment: "{{ inventory_hostname }}"
|
||||
ssh_key_type: ed25519
|
||||
|
||||
- name: Install packages
|
||||
package:
|
||||
name: git,py3-pip
|
||||
|
||||
- name: Clone siemens-spica-rilec
|
||||
become: yes
|
||||
become_user: registrator
|
||||
become_method: su
|
||||
become_flags: "-s /bin/sh"
|
||||
git:
|
||||
repo: 'https://github.com/polz113/siemens-spica-rilec'
|
||||
dest: /home/registrator/siemens-spica-rilec
|
||||
force: yes
|
||||
|
||||
- name: Install requirements for spica-rilec
|
||||
become: yes
|
||||
become_user: registrator
|
||||
become_method: su
|
||||
become_flags: '-s /bin/sh'
|
||||
pip:
|
||||
requirements: /home/registrator/siemens-spica-rilec/requirements.txt
|
||||
extra_args: --user --break-system-packages --no-warn-script-location
|
||||
|
||||
- name: Configure spica-rilec settings
|
||||
template:
|
||||
dest: "/home/registrator/siemens-spica-rilec/{{ item }}"
|
||||
src: "{{ item }}.j2"
|
||||
owner: registrator
|
||||
group: registrator
|
||||
mode: 0600
|
||||
force: no
|
||||
loop:
|
||||
- siemens_spica_settings.py
|
||||
- apis_preslikava_kadrovskih_settings.py
|
||||
|
||||
- name: Clone web app
|
||||
become: yes
|
||||
become_user: registrator
|
||||
become_method: su
|
||||
become_flags: "-s /bin/sh"
|
||||
git:
|
||||
repo: 'https://github.com/polz113/registrator.git'
|
||||
dest: /home/registrator/registrator
|
||||
force: yes
|
||||
|
||||
- name: Configure registrator settings
|
||||
template:
|
||||
dest: "/home/registrator/registrator/conf/{{ item }}"
|
||||
src: "{{ item }}.j2"
|
||||
owner: registrator
|
||||
group: registrator
|
||||
mode: 0600
|
||||
force: no
|
||||
loop:
|
||||
- loginconf.php
|
||||
|
||||
- name: Create utility / cronjob scripts
|
||||
copy:
|
||||
dest: "/home/registrator/{{ item }}"
|
||||
src: "{{ item }}"
|
||||
mode: 0744
|
||||
owner: registrator
|
||||
group: registrator
|
||||
loop:
|
||||
- get_siemens_logs.sh
|
||||
- push_siemens_to_spica.sh
|
||||
- garaze_racunovodstvo.sh
|
||||
|
||||
- name: Create log/data directories
|
||||
file:
|
||||
dest: "/home/registrator/{{ item }}"
|
||||
owner: registrator
|
||||
loop:
|
||||
- data
|
||||
- logs
|
||||
- spool
|
||||
|
||||
- name: Create garaze config
|
||||
copy:
|
||||
dest: "/home/registrator/garaze_recipients.txt"
|
||||
content: "{{ password.garaze_recipients }}"
|
||||
|
||||
- name: Set up cronjob for fetching the logs
|
||||
cron:
|
||||
name: "get siemens logs"
|
||||
job: "/home/registrator/get_siemens_logs.sh"
|
||||
user: registrator
|
||||
minute: "*/10"
|
||||
|
||||
- name: Set up cronjob for garaze
|
||||
cron:
|
||||
name: "send garaze usage"
|
||||
job: "/home/registrator/garaze_racunovodstvo.sh"
|
||||
user: registrator
|
||||
minute: "15"
|
||||
hour: "00"
|
||||
day: "1"
|
||||
|
||||
- name: Set up cronjob for spica
|
||||
cron:
|
||||
name: "push events to spica"
|
||||
job: "/home/registrator/push_siemens_to_spica.sh >> /home/registrator/logs/siemens_to_spica.log"
|
||||
user: registrator
|
||||
minute: "30"
|
||||
hour: "23"
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue