Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix filter error in ansible.builtin.file mode parameter #486

Merged
merged 4 commits into from Oct 18, 2021

Conversation

ssttehrani
Copy link
Contributor

Running ssh_hardening role in the environment specified below throws this error:
FAILED! => {"msg": "template error while templating string: expected token ',', got 'integer'.
on these tasks:

- name: Create ssh authorized principals directories
  file:
    path: '{{ item.path | dirname }}'
    mode: '{{ item.directorymode | default(0700) }}'
    owner: '{{ item.directoryowner | default(ssh_owner) }}'
    group: '{{ item.directorygroup | default(ssh_group) }}'
    state: directory
  loop: '{{ ssh_authorized_principals }}'

- name: Set ssh authorized principals
  template:
    src: 'authorized_principals.j2'
    dest: '{{ item.path }}'
    mode: '{{ item.filemode | default(0600) }}'
    owner: '{{ item.owner| default(ssh_owner) }}'
    group: '{{ item.group | default(ssh_group) }}'
  loop: '{{ ssh_authorized_principals }}'

defined in ca_keys_and_principals.yml file.

Using quotes instead of leading zero should fix this issue.

Env:

ansible [core 2.11.5]
python version = 3.9.7 (v3.9.7:1016ef3790, Aug 30 2021, 16:39:15) [Clang 6.0 (clang-600.0.57)]
jinja version = 3.0.1

@ssttehrani
Copy link
Contributor Author

ssttehrani commented Oct 12, 2021

It seems the checks error is not coming from this change but from the test framework.

@rndmh3ro
Copy link
Member

Yeah, I need to check what's wrong there.

@rndmh3ro rndmh3ro merged commit 5debcc0 into dev-sec:master Oct 18, 2021
@rndmh3ro
Copy link
Member

Thank you!

@ssttehrani ssttehrani deleted the fix/template-error branch October 19, 2021 05:00
divialth pushed a commit to divialth/ansible-collection-hardening that referenced this pull request Aug 3, 2022
* fix filter error in ansible.builtin.file mode parameter

* Change cinc supermarket

* fix link to baseline

* fix typo

Co-authored-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants