Merge pull request #16 from jitakirin/container-friendly

Make the role more container friendly
This commit is contained in:
Matt Willsher 2015-06-25 19:30:26 +01:00
commit 4a5678f93e
3 changed files with 21 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

@ -23,6 +23,14 @@
tags:
- sshd
- name: Run directory
file:
path: /var/run/sshd
state: directory
mode: 0755
tags:
- sshd
- name: Configuration
template:
src: sshd_config.j2
@ -39,6 +47,7 @@
name: "{{ sshd_service }}"
enabled: true
state: running
when: sshd_manage_service
tags:
- sshd