diff --git a/factorio.yml b/factorio.yml
new file mode 100644
index 0000000..e93afdf
--- /dev/null
+++ b/factorio.yml
@@ -0,0 +1,26 @@
+---
+
+# Infrastructure
+# Ansible instructions to deploy the infrastructure
+# Copyright (C) 2020 Saibotk
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+- hosts: factorio
+ roles:
+ - docker
+ - docker_compose
+ - docker_cleanup
+ - factorio
+ environment:
+ PYTHONPATH: /opt/python2/ansible-dependencies/lib/python2.7/site-packages
diff --git a/roles/factorio/README.md b/roles/factorio/README.md
new file mode 100644
index 0000000..df3e4cb
--- /dev/null
+++ b/roles/factorio/README.md
@@ -0,0 +1,27 @@
+Factorio
+=========
+
+This will setup a [Factorio](https://github.com/factoriotools/factorio-docker) gameserver using a docker container.
+
+Requirements
+------------
+
+You will need to have docker and docker-compose installed or declared as dependencies with their respective roles.
+
+Role Variables
+--------------
+
+**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
+
+**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
+
+Dependencies
+------------
+
+- docker
+- docker-compose
+
+License
+-------
+
+GPL-3.0-only
diff --git a/roles/factorio/defaults/main.yml b/roles/factorio/defaults/main.yml
new file mode 100644
index 0000000..ad2dba3
--- /dev/null
+++ b/roles/factorio/defaults/main.yml
@@ -0,0 +1,37 @@
+---
+# Default variables for the factorio role
+
+# Infrastructure
+# Ansible instructions to deploy the infrastructure
+# Copyright (C) 2020 Saibotk
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+# The install location (where the docker-compose file is stored)
+factorio_install_location: "/srv/factorio"
+factorio_data_location: "{{ factorio_install_location }}/data"
+
+# The camo version that should be used
+# renovate: depName=docker.io/factoriotools/factorio
+factorio_version: "1.1.0"
+
+# Docker image
+factorio_image: "docker.io/factoriotools/factorio"
+
+# The factorio server port that should be exposed
+factorio_server_port: 34197
+
+# IPv6 ULA config for the bridge network used by docker-ipv6-nat
+factorio_ipv6:
+ enabled: false
+ subnet: "fd9e:21a7:a92c:2456::/64"
diff --git a/roles/factorio/meta/main.yml b/roles/factorio/meta/main.yml
new file mode 100644
index 0000000..c52aa51
--- /dev/null
+++ b/roles/factorio/meta/main.yml
@@ -0,0 +1,16 @@
+galaxy_info:
+ author: saibotk
+ description: Installs a factorio server.
+ license: GPL-3.0-only
+ min_ansible_version: 2.9
+
+ platforms:
+ - name: CentOS
+ versions:
+ - 7
+
+ galaxy_tags: []
+
+dependencies:
+ - docker
+ - docker_compose
diff --git a/roles/factorio/tasks/main.yml b/roles/factorio/tasks/main.yml
new file mode 100644
index 0000000..4a8be43
--- /dev/null
+++ b/roles/factorio/tasks/main.yml
@@ -0,0 +1,79 @@
+---
+# Tasks file for the factorio role
+
+# Infrastructure
+# Ansible instructions to deploy the infrastructure
+# Copyright (C) 2020 Saibotk
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+- name: Update default SELinux contexts
+ sefcontext:
+ target: '{{ item }}(/.*)?'
+ setype: "container_file_t"
+ state: present
+ with_items:
+ - "{{ factorio_data_location }}"
+ tags:
+ - factorio
+ become: true
+
+- name: Create install directory
+ file:
+ path: "{{ item }}"
+ state: directory
+ mode: '0700'
+ owner: 'root'
+ group: 'root'
+ with_items:
+ - "{{ factorio_install_location }}"
+ become: true
+ tags:
+ - factorio
+
+- name: Create data directory
+ file:
+ path: "{{ item }}"
+ state: directory
+ mode: '0750'
+ owner: '845'
+ group: '845'
+ setype: "container_file_t"
+ with_items:
+ - "{{ factorio_data_location }}"
+ tags:
+ - factorio
+ become: true
+
+- name: Deploy docker-compose.yml
+ template:
+ src: docker-compose.yml
+ dest: "{{ factorio_install_location }}/docker-compose.yml"
+ mode: '0600'
+ owner: 'root'
+ group: 'root'
+ validate: python2 -m compose -f %s config -q
+ tags:
+ - docker
+ - factorio
+ become: true
+
+- name: Compose factorio container
+ docker_compose:
+ state: present
+ project_src: "{{ factorio_install_location }}"
+ pull: yes
+ remove_orphans: yes
+ tags:
+ - factorio
+ become: true
diff --git a/roles/factorio/templates/docker-compose.yml b/roles/factorio/templates/docker-compose.yml
new file mode 100644
index 0000000..32de384
--- /dev/null
+++ b/roles/factorio/templates/docker-compose.yml
@@ -0,0 +1,40 @@
+{{ ansible_managed | comment }}
+
+# Infrastructure
+# Ansible instructions to deploy the infrastructure
+# Copyright (C) 2020 Saibotk
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+version: '2.1'
+services:
+ factorio:
+ image: "{{ factorio_image }}:{{ factorio_version }}"
+ ports:
+ - "{{ factorio_server_port }}:34197/udp"
+ volumes:
+ - "{{ factorio_data_location }}:/factorio"
+ restart: always
+ networks:
+ factorio-backend:
+
+networks:
+ factorio-backend:
+ driver: bridge
+{% if factorio_ipv6 is defined and factorio_ipv6.enabled %}
+ ipam:
+ driver: default
+ config:
+ - subnet: {{ factorio_ipv6.subnet }}
+ enable_ipv6: true
+{% endif %}