在运行我的脚本时,我一直在努力

时间:2016-07-12 15:27:30

标签: ansible

当我运行我的脚本时,我不断收到“错误!字段'主机'是必需的,但未设置”。任何人都可以告诉我,我错过了什么。我目前正在尝试对2个虚拟机的2个虚拟机实施DISA强化。

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

我的主机文件的副本

[localhost]
x.x.x.x
[Database]
x.x.x.x
x.x.x.x

1 个答案:

答案 0 :(得分:0)

我想这是一本剧本......你可以尝试删除第二行:

/rest/SearchCard?param=123YH963