Skip to content

Commit

Permalink
Merge pull request #95 from AaltoScienceIT/chroot
Browse files Browse the repository at this point in the history
Make role work with chroot connections on EL 7.
  • Loading branch information
mattwillsher authored Sep 22, 2018
2 parents 5d6262a + d438f09 commit 6f43191
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
service:
name: "{{ sshd_service }}"
state: reloaded
when: "sshd_allow_reload and ansible_virtualization_type|default(None) != 'docker'"
when:
- sshd_allow_reload
- ansible_virtualization_type|default(None) != 'docker'
- ansible_connection != 'chroot'
listen: reload_sshd
13 changes: 12 additions & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,18 @@
name: "{{ sshd_service }}"
enabled: true
state: started
when: "sshd_manage_service and ansible_virtualization_type|default(None) != 'docker'"
when:
- sshd_manage_service
- ansible_virtualization_type|default(None) != 'docker'
- ansible_connection != 'chroot'

# Due to ansible bug 21026, cannot use service module on RHEL 7
- name: Enable service in chroot
command: systemctl enable {{ sshd_service }}
when:
- ansible_connection == 'chroot'
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version|int >= 7

- name: Register that this role has run
set_fact: sshd_has_run=true
Expand Down

0 comments on commit 6f43191

Please sign in to comment.