feat: initial commit
This commit is contained in:
commit
718146cd88
15 changed files with 293 additions and 0 deletions
15
tasks/cleanup.yaml
Normal file
15
tasks/cleanup.yaml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
|
||||
# docker cleanup
|
||||
- name: "docker - prune all"
|
||||
community.docker.docker_prune:
|
||||
containers: true
|
||||
images: true
|
||||
networks: true
|
||||
volumes: true
|
||||
builder_cache: true
|
||||
|
||||
# docker cleanup - force prune
|
||||
- name: "docker - force prune"
|
||||
ansible.builtin.command: "docker system prune --all --force --volumes"
|
||||
changed_when: false
|
||||
10
tasks/main.yaml
Normal file
10
tasks/main.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
|
||||
- name: "install mariadb"
|
||||
ansible.builtin.import_tasks: "mariadb.yaml"
|
||||
|
||||
- name: "install phpipam"
|
||||
ansible.builtin.import_tasks: "phpipam.yaml"
|
||||
|
||||
- name: "cleanup docker"
|
||||
ansible.builtin.import_tasks: "cleanup.yaml"
|
||||
53
tasks/mariadb.yaml
Normal file
53
tasks/mariadb.yaml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
|
||||
# create mariadb data directory
|
||||
- name: "db - create mariadb directory"
|
||||
ansible.builtin.file:
|
||||
path: "/mnt/ipam/mysql"
|
||||
state: "directory"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0775"
|
||||
|
||||
# run mariadb container
|
||||
- name: "db - run mariadb container"
|
||||
community.docker.docker_container:
|
||||
|
||||
# docker defaults
|
||||
auto_remove: "no"
|
||||
container_default_behavior: "no_defaults"
|
||||
detach: "yes"
|
||||
init: "no"
|
||||
interactive: "no"
|
||||
log_driver: "json-file"
|
||||
log_options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
memory: "0"
|
||||
paused: "no"
|
||||
privileged: "no"
|
||||
pull: "always"
|
||||
read_only: "no"
|
||||
state: "started"
|
||||
tty: "no"
|
||||
|
||||
# run mariadb
|
||||
name: "ipam-db"
|
||||
image: "docker.io/mariadb:lts"
|
||||
image_name_mismatch: "recreate"
|
||||
restart_policy: "unless-stopped"
|
||||
networks:
|
||||
- name: "ipam-network"
|
||||
volumes:
|
||||
- "/mnt/ipam/mysql:/var/lib/mysql"
|
||||
|
||||
env:
|
||||
|
||||
# mariadb
|
||||
MARIADB_ROOT_PASSWORD: "{{ phpipam_db_root_password }}"
|
||||
MARIADB_DATABASE: "{{ phpipam_db_name }}"
|
||||
MARIADB_USER: "{{ phpipam_db_user }}"
|
||||
MARIADB_PASSWORD: "{{ phpipam_db_password }}"
|
||||
|
||||
# global
|
||||
TZ: "{{ timezone }}"
|
||||
60
tasks/phpipam.yaml
Normal file
60
tasks/phpipam.yaml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
|
||||
- name: "create phpipam config directory"
|
||||
ansible.builtin.file:
|
||||
path: "/mnt/phpipam"
|
||||
state: "directory"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0775"
|
||||
|
||||
- name: "create ipam network"
|
||||
community.docker.docker_network:
|
||||
name: "ipam-network"
|
||||
driver: "bridge"
|
||||
state: "present"
|
||||
|
||||
- name: "run phpipam"
|
||||
community.docker.docker_container:
|
||||
|
||||
# docker defaults
|
||||
auto_remove: "no"
|
||||
container_default_behavior: "no_defaults"
|
||||
detach: "yes"
|
||||
init: "no"
|
||||
interactive: "no"
|
||||
log_driver: "json-file"
|
||||
log_options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
memory: "0"
|
||||
paused: "no"
|
||||
privileged: "no"
|
||||
pull: "always"
|
||||
read_only: "no"
|
||||
state: "started"
|
||||
tty: "no"
|
||||
|
||||
# phpipam
|
||||
name: "ipam-app"
|
||||
image: "docker.io/phpipam/phpipam-www:v1.7.4"
|
||||
image_name_mismatch: "recreate"
|
||||
restart_policy: "unless-stopped"
|
||||
networks:
|
||||
- name: "ipam-network"
|
||||
ports:
|
||||
- "{{ phpipam_http_port }}:80"
|
||||
volumes:
|
||||
- "/mnt/phpipam:/phpipam"
|
||||
|
||||
env:
|
||||
|
||||
# phpipam
|
||||
PHPIPAM_DB_HOST: "ipam-db"
|
||||
PHPIPAM_DB_USER: "{{ phpipam_db_user }}"
|
||||
PHPIPAM_DB_PASS: "{{ phpipam_db_password }}"
|
||||
PHPIPAM_DB_NAME: "{{ phpipam_db_name }}"
|
||||
PHPIPAM_DB_PRETTY_PRINT: "1"
|
||||
|
||||
# global
|
||||
TZ: "{{ timezone }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue