split playbook into roles

This commit is contained in:
Pim Kunis 2022-12-03 13:05:55 +01:00
parent 53bba1751e
commit 62f014d90f
9 changed files with 69 additions and 64 deletions

9
playbooks/all.yml Normal file
View file

@ -0,0 +1,9 @@
---
- name: Install pizzeria static website
hosts: nucs
roles:
- pizzeria
- name: Install Syncthing
hosts: nucs
roles:
- syncthing

View file

@ -1,62 +0,0 @@
---
- name: Setup ansible
hosts: nucs
tasks:
- name: Create Ansible directory
file:
path: /ansible
state: directory
- name: Install essential packages
apt:
pkg:
- python3-pip
state: latest
update_cache: true
- name: Install Docker
hosts: nucs
tasks:
- name: Install prerequisites
apt:
pkg:
- ca-certificates
- curl
- gnupg
- lsb-release
state: latest
update_cache: true
- name: Add Docker APT key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
- name: Add Docker repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable # TODO: parameterize distro
- name: Install Docker packages
apt:
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
state: latest
update_cache: true
- name: Install Docker module for Python
pip:
name:
- docker
- docker-compose
- name: Install pizzeria static website
hosts: nucs
tasks:
- name: Clone pizzeria repository
git:
repo: https://github.com/pizzapim/pizzeria
dest: /ansible/pizzeria
- name: Start the Docker compose
community.docker.docker_compose:
project_src: /ansible/pizzeria
pull: true
remove_orphans: true
- name: Install Syncthing
hosts: nucs
roles:
- syncthing

4
playbooks/pizzeria.yml Normal file
View file

@ -0,0 +1,4 @@
- name: Install pizzeria static website
hosts: nucs
roles:
- pizzeria

4
playbooks/syncthing.yml Normal file
View file

@ -0,0 +1,4 @@
- name: Install syncthing
hosts: nucs
roles:
- syncthing