PAMD module and YAML syntax error

Hello,

I have created a playbook based on the PAMD module, but it keeps on failing the YAML syntax stage and I am out of ideas. Please help.

Vince.

Head of the file is:

Your are missing 2 spaces in front of the second name.

Thanks for your help Kai, the error has move on! Do you think its down to spacing?

ansible-playbook --syntax-check pamd.yml

ERROR! ‘pamd’ is not a valid attribute for a Play

The error appears to have been in ‘/etc/ansible/playbooks/pamd.yml’: line 6, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  • name: Insert new rule for pam_tally2.so
    ^ here

head -20 pamd.yml

Thanks for your help Kai, the error has move on! Do you think its down to
spacing?

Sorry I didn't bay attention to the whole file.
But yes, you are missing 2 spaces in front of all the task.

And you need to remove the dash in front of tasks.

# ansible-playbook --syntax-check pamd.yml
*ERROR! 'pamd' is not a valid attribute for a Play*

The error appears to have been in '/etc/ansible/playbooks/pamd.yml': line
6, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Insert new rule for pam_tally2.so
  ^ here

# head -20 pamd.yml
---

- hosts: all
- tasks:

- name: Insert new rule for pam_tally2.so
  pamd:
    name: system-auth
    type: auth
    control: required
    module_path: pam_env.so
    new_type: auth
    new_control: required
    module_arguments: ‘deny=3 unlock_time=180’
    new_module_path: pam_tally2.so
    state: before

- name: Insert new rule for pam_cracklib.so
  pamd:
    name: system-auth

- hosts: all
   tasks:
   - name: Insert new rule for pam_tally2.so
     pamd:
       name: system-auth
       type: auth
       control: required
       module_path: pam_env.so
       new_type: auth
       new_control: required
       module_arguments: ‘deny=3 unlock_time=180’
       new_module_path: pam_tally2.so
       state: before

   - name: Insert new rule for pam_cracklib.so
     pamd:
       name: system-auth

It’s all in the indent!

Thanks Kai.