O1ahmad/ansible-role-systemd

Support multiple commands for `ExecStartPre`, `ExecStartPost`, `ExecStop`

Opened this issue · 0 comments

In systemd, it is allowed to describe more than one ExecStartPre, ExecStartPost, and ExecStop.
However, since this role describes unit_config in dict format, it is not possible to duplicate these key settings.

My idea to solve this is to have multiple lines of output with the same key when the value of unit_config is a list.

Here is example:

unit_config:
  - name: example
    ...
    Service:
      ExecStop:
        - command1
        - command2
        - command3

outputs:

[Service]
ExecStop: command1
ExecStop: command2
ExecStop: command3

Of course, if the value is not a list, only one line is output as before.

What do you think about this idea?