Externalize role

This commit is contained in:
Adrien Reslinger 2018-10-08 19:35:24 +02:00
commit 766a6874df
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
5 changed files with 355 additions and 0 deletions

39
tasks/main.yml Normal file
View file

@ -0,0 +1,39 @@
---
# - name: Change ssh port
# lineinfile: dest=/etc/ssh/sshd_config
# regexp="^Port\s"
# line="Port {{ centos_common_ssh_port }}"
# state=present
# notify: Restart ssh
# - name: Disallow password authentication
# lineinfile: dest=/etc/ssh/sshd_config
# regexp="^PasswordAuthentication"
# line="PasswordAuthentication no"
# state=present
# notify: Restart ssh
#- name: Allow SSH root access without password
# lineinfile: dest=/etc/ssh/sshd_config
# regexp="^PermitRootLogin"
# line="PermitRootLogin without-password"
# state=present
# notify: Restart ssh
- name: Installation de la configuration ssh
template: src="{{ item }}" dest=/etc/ssh/sshd_config owner=root group=root mode=0600
with_first_found:
- files:
- sshd_config-{{ ansible_hostname }}.j2
- sshd_config-{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.j2
- sshd_config.j2
# paths:
# - ../templates
notify: Restart ssh
#- name: Installation de la configuration ssh
# template: src="templates/sshd_config--{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.j2" dest=/etc/ssh/sshd_config owner=root group=root mode=0600
# when:
# - ansible_os_family == "RedHat"
# - ansible_distribution_major_version == "7"
# notify: Restart ssh