Add sshd_manage_service option

Allows disabling management of SSHd service completely, which is handy
when used in a container (where ansible is usually used during build
phase).
This commit is contained in:
jitakirin 2015-06-25 14:54:24 +01:00
parent 89d44d947f
commit bcd864fea4
3 changed files with 13 additions and 2 deletions

View file

@ -48,11 +48,18 @@ If set to True, don't apply default values. This means that you must have a
complete set of configuration defaults via either the sshd dict, or sshd_Key
variables. Defaults to *False*.
* sshd_manage_service
If set to False, the service/daemon won't be touched at all, i.e. will not try
to enable on boot or start or reload the service. Defaults to *True* unless
running inside a docker container (it is assumed ansible is used during build
phase).
* sshd_allow_reload
If set to False, a reload of sshd wont happen on change. This can help with
troubleshooting. You'll need to manually reload sshd if you want to apply the
changed configuration. Defaults to *True*.
changed configuration. Defaults to the same value as ``sshd_manage_service``.
* sshd

View file

@ -2,8 +2,11 @@
### USER OPTIONS
# Don't apply OS defaults when set to true
sshd_skip_defaults: false
# If the below is false, don't manage the service or reload the SSH
# daemon at all
sshd_manage_service: "{{ False if ansible_virtualization_type == 'docker' else True }}"
# If the below is false, don't reload the ssh deamon on change
sshd_allow_reload: yes
sshd_allow_reload: "{{ sshd_manage_service }}"
# Empty dicts to avoid errors
sshd: {}

View file

@ -39,6 +39,7 @@
name: "{{ sshd_service }}"
enabled: true
state: running
when: sshd_manage_service
tags:
- sshd