2021-12-12 01:54:20 +00:00
|
|
|
# This playbook goes through the process of setting up all the lower level
|
|
|
|
# infrastructure we need to start deploying website files to the server
|
|
|
|
# itself.
|
2021-11-26 00:34:51 +00:00
|
|
|
---
|
|
|
|
- hosts: beta
|
|
|
|
remote_user: ubuntu
|
2021-12-12 01:54:20 +00:00
|
|
|
become: yes
|
|
|
|
become_method: sudo
|
2021-11-26 00:34:51 +00:00
|
|
|
tasks:
|
2021-12-12 01:26:46 +00:00
|
|
|
- name: Install snapd package manager
|
|
|
|
apt:
|
|
|
|
name: snapd
|
|
|
|
update_cache: yes
|
|
|
|
state: present
|
|
|
|
|
2021-11-26 00:34:51 +00:00
|
|
|
- name: Install Nginx
|
|
|
|
apt:
|
|
|
|
name: nginx
|
|
|
|
update_cache: yes
|
|
|
|
state: present
|
|
|
|
|
2021-12-12 01:26:46 +00:00
|
|
|
- name: Update Snap
|
|
|
|
community.general.snap:
|
|
|
|
name: core
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Install Certbot Snap Package
|
|
|
|
community.general.snap:
|
|
|
|
name: certbot
|
|
|
|
classic: yes
|
|
|
|
|
2021-12-12 01:54:20 +00:00
|
|
|
- name: Create website admin group
|
|
|
|
group:
|
|
|
|
name: web
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create website user account
|
|
|
|
user:
|
|
|
|
name: web
|
|
|
|
comment: Website maintainer account
|
|
|
|
state: present
|
|
|
|
|
2022-10-22 03:55:52 +00:00
|
|
|
- name: Create /home/web/.ssh directory
|
|
|
|
file:
|
|
|
|
path: /home/web/.ssh
|
|
|
|
state: directory
|
|
|
|
owner: web
|
|
|
|
group: web
|
|
|
|
mode: 0700
|
|
|
|
|
|
|
|
- name: Copy public web key to beta
|
|
|
|
authorized_key:
|
|
|
|
user: web
|
|
|
|
key: "{{ lookup('file', 'files/'+'web.pub') }}"
|
|
|
|
|
|
|
|
|
2021-12-12 01:54:20 +00:00
|
|
|
- name: Create Web root directory under new web account
|
|
|
|
file:
|
|
|
|
path: /var/www
|
|
|
|
state: directory
|
|
|
|
recurse: yes
|
|
|
|
owner: web
|
|
|
|
group: web
|
|
|
|
|
2021-12-12 01:26:46 +00:00
|
|
|
|
|
|
|
|