Skip to content

Commit

Permalink
Make templating work with Jinja2 >= 3.0.0
Browse files Browse the repository at this point in the history
Without this change you'll see the following error:

    TASK [infrastructure/johanmeiring.sftp-server : SFTP-Server | Correct ownership and permission of home directories] ************************************
    fatal: [sftp-server]: FAILED! =>
      msg: 'template error while templating string: expected token '','', got ''integer''. String: {{ item.mode | default(0750) }}'

See pallets/jinja#1171
  • Loading branch information
giner committed May 21, 2021
1 parent 171ce2c commit 60c113f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
path: "{{ item.home }}"
owner: root
group: "{{ item.group | default(sftp_group_name) }}"
mode: "{{ item.mode | default(0750) }}"
mode: "{{ item.mode | default('0750') }}"
with_items: "{{ _sftp_users }}"

# Install all relevant public keys.
Expand Down Expand Up @@ -118,7 +118,7 @@
path: "{{ item[0].home }}/{{ item[1].name | default(item[1]) }}"
owner: "{{ item[0].name }}"
group: "{{ item[0].group | default(item[0].name) }}"
mode: "{{ item[1].mode | default(0750) }}"
mode: "{{ item[1].mode | default('0750') }}"
state: directory
with_nested:
- "{{ _sftp_users }}"
Expand All @@ -130,7 +130,7 @@
path: "{{ item[0].home }}/{{ item[1].name | default(item[1]) }}"
owner: "{{ item[0].name }}"
group: "{{ item[0].group | default(item[0].name) }}"
mode: "{{ item[1].mode | default(0750) }}"
mode: "{{ item[1].mode | default('0750') }}"
state: directory
with_subelements:
- "{{ _sftp_users }}"
Expand Down

0 comments on commit 60c113f

Please sign in to comment.