2024-09-12 03:35:31 +00:00
|
|
|
---
|
2024-09-30 01:05:27 +00:00
|
|
|
- name: Setup all attributes of the html-deployer user for static website CI
|
|
|
|
hosts: webhost
|
2024-09-12 03:35:31 +00:00
|
|
|
vars:
|
|
|
|
username: html-deployer
|
|
|
|
remote_user: webadmin
|
|
|
|
tasks:
|
|
|
|
- name: Create user for git actions to deploy html
|
|
|
|
become: true
|
2024-09-30 01:05:27 +00:00
|
|
|
ansible.builtin.user:
|
2024-09-12 03:35:31 +00:00
|
|
|
name: "{{ username }}"
|
|
|
|
comment: Used for deploying html from Gitea Actions
|
|
|
|
group: nginx
|
2024-09-12 04:21:25 +00:00
|
|
|
- name: Set the authorized keys
|
|
|
|
become: true
|
2024-09-30 01:05:27 +00:00
|
|
|
ansible.posix.authorized_key:
|
2024-09-12 04:21:25 +00:00
|
|
|
user: "{{ username }}"
|
|
|
|
state: present
|
|
|
|
key: "{{ lookup('file', '~/.ssh/vultr/html-deployer.pem.pub') }}"
|
2024-09-30 01:05:27 +00:00
|
|
|
- name: Ensure /opt/nginx website folders are owned by html-deployer
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "/opt/nginx/{{ item }}"
|
|
|
|
recurse: true
|
|
|
|
owner: "{{ username }}"
|
|
|
|
group: "nginx"
|