ansible-playbook-static-sit.../roles/static-server/tasks/setup_site.yml

22 lines
1.0 KiB
YAML
Raw Normal View History

2023-11-10 13:21:47 +00:00
- name: Create site user group
ansible.builtin.group: name="{{ site.user }}" state=present
- name: Create site user
user: name="{{ site.user }}" shell=/bin/bash home="{{ static_site_server_base_path }}/{{ site.user }}" createhome=yes group="{{ site.user }}" groups= state=present
- name: Ensure public path is present
ansible.builtin.file: path="{{ static_site_server_base_path }}/{{ site.user }}/{{ site.domain }}" owner="{{ site.user }}" group="{{ site.user }}" mode=0700 state=directory
2023-11-10 13:21:47 +00:00
- name: Ensure .ssh path is present
2023-11-10 14:00:51 +00:00
ansible.builtin.file: path="{{ static_site_server_base_path }}/{{ site.user }}/.ssh" owner="{{ site.user }}" group="{{ site.user }}" mode=0700 state=directory
2023-11-10 13:21:47 +00:00
- name: Seting up authorized keys
ansible.posix.authorized_key:
user: "{{ site.user }}"
key: "{{ site.key }}"
state: present
- name: Ensure correct permissions for authorized keys file
2023-11-10 14:00:51 +00:00
ansible.builtin.file: path="{{ static_site_server_base_path }}/{{ site.user }}/.ssh/authorized_keys" owner="{{ site.user }}" group="{{ site.user }}" mode=0600 state=file