server-config/roles/pxe/tasks/mac2hostname.yml

43 lines
1.3 KiB
YAML

---
# Installa e configura il servizio per rinominare il client
# Grazie per il servizio a Enrico Bacis
- name: Installazione dipendenze Python
yum: pkg=python-bottle state=present
sudo: yes
- name: Creazione directory necessarie
file: path={{ item }} state=directory
with_items:
- /var/lib/mac2hostname
- /var/run/mac2hostname
- /var/log/mac2hostname
- /usr/share/mac2hostname
sudo: yes
- name: Copia dello script
copy: src=mac2hostname.py dest=/usr/share/mac2hostname/mac2hostname.py mode=0755
sudo: yes
- name: Finalizzazione della copia
file: src=/usr/share/mac2hostname/mac2hostname.py dest=/usr/bin/mac2hostname state=link
sudo: yes
- name: Aggiunto oggetto servizio mac2hostname
shell: /sbin/e-smith/db fwservices set mac2hostname fwservice Description "mac2hostname service" Ports 3000 Protocol tcp
sudo: yes
- name: Attivo modifiche a livello di servizio
shell: /sbin/e-smith/signal-event firewall-objects-modify
sudo: yes
- name: Aggiungo regola firewall mac2hostname
shell: /sbin/e-smith/db fwrules set 1 rule Action accept Description "mac2hostname allow local traffic" Dst any Log none Position 64 service "fwservice;mac2hostname" Src "role;green" status enabled
sudo: yes
- name: Attivo modifiche firewall
shell: /sbin/e-smith/signal-event firewall-adjust
sudo: yes