mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-24 20:10:20 +01:00
test: set TMPDIR in block of role invocation (#300)
Setting TMPDIR globally causes problems on some platforms. Instead, set it at the `block` level and put the role invocation inside the block. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
This commit is contained in:
parent
d10f2ada11
commit
3331fa7b35
1 changed files with 14 additions and 18 deletions
|
@ -1,8 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: Test quote with unsafe input
|
- name: Test quote with unsafe input
|
||||||
hosts: all
|
hosts: all
|
||||||
environment:
|
|
||||||
TMPDIR: "{{ __tmpdir }}"
|
|
||||||
vars:
|
vars:
|
||||||
__sshd_test_backup_files:
|
__sshd_test_backup_files:
|
||||||
- /etc/ssh/sshd_config
|
- /etc/ssh/sshd_config
|
||||||
|
@ -21,29 +19,27 @@
|
||||||
path: /tmp/BADFLAG
|
path: /tmp/BADFLAG
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Assert TMPDIR is correctly set
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that:
|
|
||||||
- __tmpdir != ''
|
|
||||||
- ansible_facts.env.TMPDIR == __tmpdir
|
|
||||||
|
|
||||||
- name: "Backup configuration files"
|
- name: "Backup configuration files"
|
||||||
ansible.builtin.include_tasks: tasks/backup.yml
|
ansible.builtin.include_tasks: tasks/backup.yml
|
||||||
|
|
||||||
- name: Create BAD TMPDIR
|
- name: Create BAD TMPDIR
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: directory
|
state: directory
|
||||||
path: "{{ ansible_facts.env.TMPDIR }}"
|
path: "{{ __tmpdir }}"
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
- name: Configure sshd with BAD config
|
- name: Wrap this in a block to set environment
|
||||||
ansible.builtin.include_role:
|
environment:
|
||||||
name: ansible-sshd
|
TMPDIR: "{{ __tmpdir }}"
|
||||||
vars:
|
block:
|
||||||
sshd_skip_defaults: true
|
- name: Configure sshd with BAD config
|
||||||
sshd_verify_hostkeys: []
|
ansible.builtin.include_role:
|
||||||
when:
|
name: ansible-sshd
|
||||||
- ansible_facts['os_family'] != 'RedHat' or ansible_facts['distribution_major_version'] | int != 8
|
vars:
|
||||||
|
sshd_skip_defaults: true
|
||||||
|
sshd_verify_hostkeys: []
|
||||||
|
when:
|
||||||
|
- ansible_facts['os_family'] != 'RedHat' or ansible_facts['distribution_major_version'] | int != 8
|
||||||
|
|
||||||
- name: Verify the options are correctly set
|
- name: Verify the options are correctly set
|
||||||
tags: tests::verify
|
tags: tests::verify
|
||||||
|
@ -64,7 +60,7 @@
|
||||||
- name: Remove BAD TMPDIR
|
- name: Remove BAD TMPDIR
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ ansible_facts.env.TMPDIR }}"
|
path: "{{ __tmpdir }}"
|
||||||
|
|
||||||
- name: "Restore configuration files"
|
- name: "Restore configuration files"
|
||||||
ansible.builtin.include_tasks: tasks/restore.yml
|
ansible.builtin.include_tasks: tasks/restore.yml
|
||||||
|
|
Loading…
Reference in a new issue