81 lines
2.1 KiB
YAML
81 lines
2.1 KiB
YAML
---
|
|
- name: Setup ansible
|
|
hosts: nucs
|
|
tasks:
|
|
- name: create ansible directory
|
|
file:
|
|
path: /ansible # TODO: parameterize?
|
|
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 gpg 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 the repository
|
|
git:
|
|
repo: https://github.com/pizzapim/pizzeria
|
|
dest: /ansible/pizzeria # TODO: parameterize?
|
|
- name: start the docker compose
|
|
community.docker.docker_compose:
|
|
project_src: /ansible/pizzeria
|
|
pull: true
|
|
remove_orphans: true
|
|
- name: Install syncthing
|
|
hosts: nucs
|
|
tasks:
|
|
- name: install syncthing
|
|
apt:
|
|
pkg:
|
|
- syncthing
|
|
state: latest
|
|
update_cache: true
|
|
- name: create syncthing user
|
|
user:
|
|
name: syncthing
|
|
home: /home/syncthing
|
|
state: present
|
|
- name: copy syncthing configuration
|
|
template:
|
|
src: "{{ playbook_dir }}/files/config.xml.j2"
|
|
dest: /home/syncthing/.config/syncthing/config.xml
|
|
- name: enable syncthing service
|
|
systemd:
|
|
name: "syncthing@syncthing"
|
|
enabled: true
|
|
state: restarted
|