Ansible-检查PermitroLogin是否等于否
我是新来的 我想知道/etc/ssh/sshd_config中permitrotlogin=no的值Ansible-检查PermitroLogin是否等于否,ansible,redhat,Ansible,Redhat,我是新来的 我想知道/etc/ssh/sshd_config中permitrotlogin=no的值 - hosts: RH7 tasks: - name: read File shell: cat /etc/ssh/sshd_config register: PermitRootLogin no 请帮帮我你可以用这样的东西: - hosts: RH7 tasks: - name: read File shell: awk '/#PermitRoot
- hosts: RH7
tasks:
- name: read File
shell: cat /etc/ssh/sshd_config
register: PermitRootLogin no
请帮帮我你可以用这样的东西:
- hosts: RH7
tasks:
- name: read File
shell: awk '/#PermitRootLogin/ {print $2}' /etc/ssh/sshd_config
register: PermitRootLogin
- debug: msg="{{ PermitRootLogin.stdout }}"
cat/etc/ssh/sshd_-config | awk'/#permitrotlogin/{print$2}'
:此命令将从文件/etc/ssh/sshd_-config
中提供permitrotlogin的输出
我们将把值保存在permitrotlogin
变量中,并可以使用debug
命令查看它