The terraform module does not expect its file contents (project_path) in the 'files/' folder like the core roles, instead looking for it relative to the _invocation_ pwd. So, for now it just resides in the root level of the repository and may be moved from there to wherever it is more pertinent. Additionally, we check for the existence of the OpenTofu binary (tofu), and prefer that if it exists. Otherwise we fall back to the Terraform binary.
104 lines
2.6 KiB
YAML
104 lines
2.6 KiB
YAML
---
|
|
# TODO: Add to bootstrapping role / make less dependent on apt-get & debian (python3)
|
|
- name: Bootstrap python everywhere
|
|
hosts: all
|
|
gather_facts: False
|
|
become: true
|
|
tags:
|
|
- bootstrap
|
|
tasks:
|
|
- name: check for python
|
|
ansible.builtin.raw: python3 --version
|
|
changed_when: false
|
|
failed_when: false
|
|
register: pythoncheck
|
|
- name: install debian python
|
|
ansible.builtin.raw: apt-get update && apt-get install python3 -y
|
|
when: not ansible_check_mode and pythoncheck.rc == 127
|
|
- name: pretend installing debian python for check mode
|
|
ansible.builtin.debug:
|
|
msg: Pretending to install python...
|
|
when: ansible_check_mode
|
|
|
|
- name: Prepare incus server host
|
|
hosts: host_system
|
|
tasks:
|
|
- name: Prepare host filesystems
|
|
ansible.builtin.import_role:
|
|
name: filesystem
|
|
tags: filesystem
|
|
|
|
- name: Prepare system
|
|
ansible.builtin.import_role:
|
|
name: system
|
|
tags: system
|
|
|
|
- name: Set up incus
|
|
ansible.builtin.import_role:
|
|
name: incus-install
|
|
tags: incus
|
|
|
|
- name: Set up nfs shares
|
|
ansible.builtin.import_role:
|
|
name: nfs
|
|
tags: nfs
|
|
|
|
# FIXME: Role needs much fixup before it can run
|
|
# - name: Prepare incus
|
|
# ansible.builtin.import_role:
|
|
# name: incus-install
|
|
# tags: incus
|
|
|
|
- name: Raise infrastructure
|
|
hosts: localhost
|
|
tags: infrastructure
|
|
tasks:
|
|
- ansible.builtin.import_role:
|
|
name: infrastructure
|
|
|
|
# ansible-galaxy install geerlingguy.docker
|
|
- name: Install docker
|
|
hosts: instance_system
|
|
tags: docker
|
|
tasks:
|
|
- name: Install docker and docker compose
|
|
ansible.builtin.import_role:
|
|
name: geerlingguy.docker
|
|
|
|
- name: Install docker python requirements
|
|
ansible.builtin.package:
|
|
name: "{{ item }}"
|
|
state: present
|
|
loop:
|
|
- python3-yaml # for docker compose_v2
|
|
- python3-requests # for docker network
|
|
|
|
- name: Prepare all docker hosted containers
|
|
gather_facts: True
|
|
hosts: instance_system
|
|
tags:
|
|
- containers
|
|
tasks:
|
|
- name: Set up Caddy stack
|
|
ansible.builtin.import_role:
|
|
name: caddy
|
|
tags: caddy
|
|
|
|
- name: Set up Restic stack
|
|
ansible.builtin.import_role:
|
|
name: restic
|
|
|
|
- name: Set up Arr stack
|
|
ansible.builtin.import_role:
|
|
name: arr
|
|
tags: arr
|
|
|
|
- name: Set up Paperless stack
|
|
ansible.builtin.import_role:
|
|
name: paperless
|
|
tags: paperless
|
|
|
|
- name: Set up Grocy stack
|
|
ansible.builtin.import_role:
|
|
name: grocy
|
|
tags: grocy
|