2016-07-12 10 views
0

私のスクリプトを実行すると、 "ERROR!フィールド 'ホスト'は必須ですが設定されていません。誰でも私が行方不明であることを教えてください。私は現在、2 CentOS 6台の仮想マシンにDISA stig hardeningを実装しようとしています。私のスクリプトを実行するときに私は続ける

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

エラー?それはどの行で起こりますか?あなたは完全な出力を投稿できますか? –

+0

また、あなたがリストしたいくつかのコマンドには、yumのような同等のものがあります。 –

+0

タスクのパディングをチェックします。多分1つのタスクが誤って遊びになったかもしれません。上記のコメントに述べられているように、多くのコマンドは、ネイティブモジュールで置き換える必要があります。 –

答えて

0

のコピーが脚本です...あなたは二行目を削除してみてください:

私たちは、の詳細が必要になります
--- 
- hosts: Database 
    tasks: 
    ... 
関連する問題