1

When running my script I keep getting "ERROR! the field 'hosts' is required but was not set". Can anyone please tell me what it is that I am missing. I am currently trying to implement DISA stig hardening on to 2 centos 6 virtual machines.

---
- 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

A copy of my host file

[localhost]
x.x.x.x
[Database]
x.x.x.x
x.x.x.x
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188

1 Answers1

0

I suppose this is a playbook... could you try removing the second line:

---
- hosts: Database
  tasks:
  ...
Javier Segura
  • 658
  • 4
  • 13