Skip to content

Commit

Permalink
Create needed directories
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten committed Oct 30, 2024
1 parent af972bf commit 32468df
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
39 changes: 36 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,42 @@
- ssh-server
- ssh-server-check-host-keys

- name: stat directories

Check warning on line 60 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
ansible.builtin.stat:
path: "{{ item }}/"
register: _stat_directories
with_items:
- "{{ ssh_server_config_file | dirname }}"
- "{{ ssh_server_runtime_directory }}"
tags:
- configuration
- ssh-server
- ssh-server-configure
- ssh-server-configure-directories
- ssh-server-configure-directories-stat

- name: create directories
ansible.builtin.file:
path: "{{ item.item }}"
state: directory
owner: root
group: root
mode: 0755
with_items: "{{ _stat_directories.results }}"
when:
- item.stat is defined
- not item.stat.exists
tags:
- configuration
- ssh-server
- ssh-server-configure
- ssh-server-configure-directories
- ssh-server-configure-directories-create

- name: update configuration file
ansible.builtin.template:
src: etc/ssh/sshd_config.j2
dest: /etc/ssh/sshd_config
src: "{{ ssh_server_config_file.lstrip('/') }}.j2"
dest: "{{ ssh_server_config_file }}"
owner: root
group: root
mode: 0644
Expand All @@ -69,7 +101,8 @@
tags:
- configuration
- ssh-server
- ssh-server-configuration
- ssh-server-configure
- ssh-server-configure-file

- name: start and enable service
ansible.builtin.service:
Expand Down
3 changes: 3 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
---
ssh_server_dependencies:
- openssh-server

ssh_server_config_file: /etc/ssh/sshd_config
ssh_server_runtime_directory: /run/sshd

0 comments on commit 32468df

Please sign in to comment.