PAMD module and YAML syntax error

129 views
Skip to first unread message

Vincent Andrews

unread,
Jan 18, 2018, 5:36:10 AM1/18/18
to Ansible Project
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:

---

- 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

Th error is:

# ansible-playbook  --syntax-check pamd.yml
ERROR! Syntax Error while loading YAML.


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

The offending line appears to be:

  name: system-auth
    type: auth
        ^ here

exception type: <class 'yaml.scanner.ScannerError'>
exception: mapping values are not allowed in this context
  in "<unicode string>", line 8, column 9

Kai Stian Olstad

unread,
Jan 18, 2018, 6:35:21 AM1/18/18
to ansible...@googlegroups.com
On 18.01.2018 11:36, Vincent Andrews wrote:
> 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:
>
> ---
>
> - hosts: all
> - tasks:
> - name: Insert new rule for pam_tally2.so
> pamd:
> name: system-auth

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

--
Kai Stian Olstad

Vincent Andrews

unread,
Jan 18, 2018, 7:00:51 AM1/18/18
to Ansible Project
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
---

- 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

Kai Stian Olstad

unread,
Jan 18, 2018, 7:12:49 AM1/18/18
to ansible...@googlegroups.com
On 18.01.2018 13:00, Vincent Andrews wrote:
> 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*
- 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

--
Kai Stian Olstad

Vincent Andrews

unread,
Jan 18, 2018, 9:07:56 AM1/18/18
to Ansible Project
It's all in the indent!

Thanks Kai.


Reply all
Reply to author
Forward
0 new messages