This repository has been archived on 2023-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
max/playbooks/nucs.yml

63 lines
1.5 KiB
YAML
Raw Normal View History

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