Possible to change file permission (mode) multiple times?
I've run into an issue where using sshauthorizedkey fails if the target ~/.ssh/authorized_keys file is read-only (mode 0400).
FYI: The error is Sshauthorizedkey[username]) Could not evaluate: Puppet::Util::FileType::FileTypeFlat could not write /home/username/.ssh/authorizedkeys: Permission denied - /home/username/.ssh/authorizedkeys
One idea I had was if I could do a file resource that changed the permission to writable, performed the Sshauthorizedkey, and then another file resource that changed it back to read-only. You can't duplicate resources though so I'm not sure if this could ... (more)