0
Wenn ich mein Skript ausführe bekomme ich immer "ERROR! Das Feld 'Hosts' ist erforderlich, wurde aber nicht gesetzt". Kann mir bitte jemand sagen, was ich vermisse. Ich versuche derzeit, DISA Stig Hardening auf 2 Centos 6 virtuelle Maschinen zu implementieren.Wenn ich mein Skript ausführe bekomme ich immer
---
- name: Stig implementation
hosts: Database
tasks:
- name: upgrade all packages
command: yum upgrade -y
- name: update all packages
command: yum update -y
- name: /etc/passd file is owned by root
command: chown root:root /etc/passwd
- name: remove rsh-server package
command: yum erase rsh-server
- name: bootload configuration owner is root
command: chgrp root /etc/grub.conf
- name: rshd service disabled
command: chkconfig rsh off
- name: rexecd service disabled
command: chkconfig rexec off
- name: remove telnet and telnet-server
command: yum erase telnet-server && yum erase telnet
- lineinfile: dest=/etc/ssh/sshd_config
state=present
regexp='PermitEmptyPasswords'
line='PermitEmptyPasswords no'
backup=yes
- lineinfile: dest=/etc/ssh/sshd_config
state=present
regexp='HostbasedAuthentication'
line='HostbasedAuthentication no'
backup=yes
- name: Change etc/group ownership
command: chgrp root /etc/group
- name: operating system must connect to external networks
command: chkconfig ip6tables on && service ip6tables start
- name: add lines
lineinfile: dest=/etc/audit/audit.rules
line='{{item}}'
with_items:
- '-w /sbin/insmod -p x -k modules'
- '-w /sbin/rmmod -p x -k modules'
- '-w /sbin/modprobe -p x -k modules'
- '-a always,exit -F arch=[b64] -S init_module -S delete_module -k modules'
- name: disable xinetd
command: chkconfig xinetd off && service xinetd stop
- name: turn off and disable netconsole
command: chkconfig netconsole off && service netconsole stop
Eine Kopie meiner Host-Datei
[localhost]
x.x.x.x
[Database]
x.x.x.x
x.x.x.x
auf der Fehler-- in welcher Zeile tritt es auf? Kannst du die volle Ausgabe posten? –
Außerdem haben einige Befehle, die Sie aufgelistet haben, bereits zulässige Äquivalente - wie zum Beispiel yum. –
Überprüfen Sie das Auffüllen von Aufgaben. Vielleicht wurde eine Aufgabe versehentlich zu einem Spiel. Und wie oben in den Kommentaren erwähnt, sollten viele Befehle durch ansible native Module ersetzt werden. –