update molecule scenarios

This commit is contained in:
Élie Deloumeau-Prigent
2022-08-22 16:40:40 +02:00
parent eb57d613dc
commit 8382c9f3f3
10 changed files with 65 additions and 26 deletions

View File

@ -1,6 +1,6 @@
---
- name: configure_motd | Apply template {{ motd_template }} on {{ _motd_file_path }}
copy:
ansible.builtin.copy:
content: "{{ motd_template_prepend + _motd_template_content + motd_template_append }}"
dest: "{{ _motd_file_path }}"
owner: root
@ -10,7 +10,7 @@
- molecule-idempotence-notest
- name: configure_motd | Add pam_exec {{ _motd_file_path }} in pam
lineinfile:
ansible.builtin.lineinfile:
path: "{{ item }}"
line: session optional pam_exec.so type=open_session stdout {{ _motd_file_path }}
loop:

View File

@ -1,18 +1,18 @@
---
- name: disable_default_motd | Get stats of {{ _motd_sshd_config_file_path }}
stat:
ansible.builtin.stat:
path: "{{ _motd_sshd_config_file_path }}"
register: _motd_sshd_config_file_stat
- name: disable_default_motd | Ensure PrintMotd is set to "no" in {{ _motd_sshd_config_file_path }}
lineinfile:
ansible.builtin.lineinfile:
path: "{{ _motd_sshd_config_file_path }}"
regexp: "^PrintMotd "
line: PrintMotd no
when: _motd_sshd_config_file_stat.stat.exists
- name: disable_default_motd | Comment out pam_motd in pam
replace:
ansible.builtin.replace:
path: "{{ item }}"
regexp: '^(session\s+optional\s+pam_motd.so\s+.*)'
replace: '# \1'

View File

@ -1,7 +1,8 @@
---
- name: include_tasks disable_default_motd.yml if motd_disable_default_motd is True
include_tasks: disable_default_motd.yml
- name: Include disable_default_motd.yml if motd_disable_default_motd is True
ansible.builtin.include_tasks: disable_default_motd.yml
when: motd_disable_default_motd|bool
- include_tasks: configure_motd.yml
- name: Include configure_motd.yml
ansible.builtin.include_tasks: configure_motd.yml
...