Skip to content

Commit

Permalink
Add create: true to lineinfile to create the file if it doesn't exist
Browse files Browse the repository at this point in the history
Use lower case title for consistency

Set mode properly
  • Loading branch information
spetrosi committed Sep 23, 2021
1 parent 3ccd598 commit 17da2f5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tasks/main-blivet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,18 @@
#
# Manage /etc/crypttab
#
- name: Manage /etc/crypttab to account for changes we just made
- name: retrieve facts for the /etc/crypttab file
stat:
path: /etc/crypttab
register: __storage_crypttab

- name: manage /etc/crypttab to account for changes we just made
lineinfile:
path: /etc/crypttab
line: "{{ entry.name }} {{ entry.backing_device }} {{ entry.password }}"
state: "{{ entry.state }}"
create: true
mode: "{{ __storage_crypttab.stat.mode | d('0600') }}"
loop: "{{ blivet_output.crypts }}"
loop_control:
loop_var: entry
Expand Down

0 comments on commit 17da2f5

Please sign in to comment.