semaphore-playbooks/debian12-forgejo/playbook.yml

57 lines
1.3 KiB
YAML
Raw Normal View History

2023-08-05 17:11:17 +00:00
---
- name: Update web servers
hosts: all
remote_user: root
tasks:
- name: Install a list of packages
2023-08-05 17:27:30 +00:00
ansible.builtin.apt:
pkg:
- mariadb-server
2023-08-05 17:11:17 +00:00
- name: Add the user 'git'
ansible.builtin.user:
name: git
comment: Git Username
home: /home/git
shell: /bin/bash
- name: Create /var/lib/forgejo
ansible.builtin.file:
path: /var/lib/forgejo
state: directory
2023-08-05 17:28:50 +00:00
owner: git
2023-08-05 17:11:17 +00:00
group: git
mode: '0750'
- name: Create /etc/forgejo
ansible.builtin.file:
path: /etc/forgejo
state: directory
2023-08-05 17:28:50 +00:00
owner: git
2023-08-05 17:11:17 +00:00
group: git
2023-08-05 17:33:14 +00:00
mode: '0500'
#Database
- name: Create a new database with name 'forgejo'
community.mysql.mysql_db:
name: forgejo
state: present
login_unix_socket: /run/mysqld/mysqld.sock
- name: Removes anonymous user account for localhost
community.mysql.mysql_user:
name: ''
host: localhost
state: absent
login_unix_socket: /run/mysqld/mysqld.sock
- name: Removes all anonymous user accounts
community.mysql.mysql_user:
name: ''
host_all: true
state: absent
- name: Create database user forgejo
community.mysql.mysql_user:
name: forgejo
password: "FBnA!wiEJ!W&GTy@!Tf3$aV&WLvPD628GM%9&JUtssr3hr"
priv: 'forgejo.*:ALL'
state: present