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 complete set of configuration defaults via either the sshd dict, or sshd_Key
variables. Defaults to *False*. 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 * sshd_allow_reload
If set to False, a reload of sshd wont happen on change. This can help with 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 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 * sshd

View file

@ -2,8 +2,11 @@
### USER OPTIONS ### USER OPTIONS
# Don't apply OS defaults when set to true # Don't apply OS defaults when set to true
sshd_skip_defaults: false 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 # 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 # Empty dicts to avoid errors
sshd: {} sshd: {}

View file

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