2023-07-16 17:28:34 +05:30
|
|
|
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
|
|
|
---
|
|
|
|
- name: Deploy libreddit
|
|
|
|
hosts: bullseye_libreddit
|
|
|
|
remote_user: atm
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Create /etc/apt/keyrings dir
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.file:
|
|
|
|
path: /etc/apt/keyrings
|
|
|
|
state: directory
|
|
|
|
recurse: true
|
|
|
|
|
|
|
|
- name: Add Docker GPG apt Key
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.apt_key:
|
|
|
|
url: https://download.docker.com/linux/debian/gpg
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Add Docker Repository
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.apt_repository:
|
|
|
|
repo: deb https://download.docker.com/linux/debian buster stable
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Update apt and install docker-ce
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.apt:
|
|
|
|
name: docker-ce
|
|
|
|
update_cache: true
|
|
|
|
|
|
|
|
- name: Install Docker Module for Python
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.pip:
|
|
|
|
name: docker
|
|
|
|
|
|
|
|
- name: Ensure docker group is present
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.group:
|
|
|
|
name: docker
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Add user atm to docker group
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.user:
|
|
|
|
name: atm
|
|
|
|
groups: docker,users,admin
|
|
|
|
|
|
|
|
- name: Deploy libreddit
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
ansible.builtin.docker_container:
|
|
|
|
name: libreddit
|
|
|
|
state: started
|
|
|
|
image: "spikecodes/libreddit"
|
|
|
|
pull: true
|
|
|
|
ports:
|
|
|
|
- "8080:8080"
|
|
|
|
|
|
|
|
- name: Allow port 8080
|
2023-07-20 13:42:30 +05:30
|
|
|
become: true
|
2023-07-16 17:28:34 +05:30
|
|
|
community.general.ufw:
|
|
|
|
state: enabled
|
|
|
|
proto: tcp
|
|
|
|
rule: allow
|
|
|
|
port: "8080"
|