From c390da921fda96d6ac2dab1721fbf256ef752ca2 Mon Sep 17 00:00:00 2001
From: s3lph <account-gitlab-ideynizv@kernelpanic.lol>
Date: Mon, 14 Dec 2020 21:53:02 +0100
Subject: [PATCH] Add inspircd role, installation only so far

---
 README.md                        |  3 ++
 galaxy.yml                       | 65 ++++++++++++++++++++++++++++++++
 roles/inspircd/handlers/main.yml | 11 ++++++
 roles/inspircd/tasks/config.yml  |  1 +
 roles/inspircd/tasks/install.yml | 19 ++++++++++
 roles/inspircd/tasks/main.yml    | 11 ++++++
 6 files changed, 110 insertions(+)
 create mode 100644 README.md
 create mode 100644 galaxy.yml
 create mode 100644 roles/inspircd/handlers/main.yml
 create mode 100644 roles/inspircd/tasks/config.yml
 create mode 100644 roles/inspircd/tasks/install.yml
 create mode 100644 roles/inspircd/tasks/main.yml

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8fd8f2c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Ansible Collection - s3lph.irc
+
+Documentation for the collection.
diff --git a/galaxy.yml b/galaxy.yml
new file mode 100644
index 0000000..e83a18d
--- /dev/null
+++ b/galaxy.yml
@@ -0,0 +1,65 @@
+### REQUIRED
+# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
+# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
+# underscores or numbers and cannot contain consecutive underscores
+namespace: s3lph
+
+# The name of the collection. Has the same character restrictions as 'namespace'
+name: irc
+
+# The version of the collection. Must be compatible with semantic versioning
+version: 0.1
+
+# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
+readme: README.md
+
+# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
+# @nicks:irc/im.site#channel'
+authors:
+- s3lph <account-gitlab-ideynizv@kernelpanic.lol>
+
+
+### OPTIONAL but strongly recommended
+# A short summary description of the collection
+description: InspIRCd server setup
+
+# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
+# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
+license:
+- MIT
+
+# The path to the license file for the collection. This path is relative to the root of the collection. This key is
+# mutually exclusive with 'license'
+#license_file: ''
+
+# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
+# requirements as 'namespace' and 'name'
+tags:
+  - inspircd
+  - irc
+  - ircd
+
+# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
+# collection label 'namespace.name'. The value is a version range
+# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
+# range specifiers can be set and are separated by ','
+dependencies: {}
+
+# The URL of the originating SCM repository
+repository: https://gitlab.com/s3lph/ansible-collection-irc
+
+# The URL to any online docs
+documentation: https://gitlab.com/s3lph/ansible-collection-irc
+
+# The URL to the homepage of the collection/project
+homepage: https://gitlab.com/s3lph/ansible-collection-irc
+
+# The URL to the collection issue tracker
+issues: https://gitlab.com/s3lph/ansible-collection-irc/-/issues
+
+# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
+# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This
+# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
+# and '.git' are always filtered
+build_ignore: []
+
diff --git a/roles/inspircd/handlers/main.yml b/roles/inspircd/handlers/main.yml
new file mode 100644
index 0000000..1aeaf6f
--- /dev/null
+++ b/roles/inspircd/handlers/main.yml
@@ -0,0 +1,11 @@
+---
+
+- name: restart inspircd
+  service:
+    name: inspircd
+    state: restarted
+
+- name: reload inspircd
+  service:
+    name: inspircd
+    state: reloaded
diff --git a/roles/inspircd/tasks/config.yml b/roles/inspircd/tasks/config.yml
new file mode 100644
index 0000000..ed97d53
--- /dev/null
+++ b/roles/inspircd/tasks/config.yml
@@ -0,0 +1 @@
+---
diff --git a/roles/inspircd/tasks/install.yml b/roles/inspircd/tasks/install.yml
new file mode 100644
index 0000000..7224286
--- /dev/null
+++ b/roles/inspircd/tasks/install.yml
@@ -0,0 +1,19 @@
+---
+
+- name: add s3lphrepo key
+  apt_key:
+    url: https://kernelpanic.lol/repo/repo.gpg
+
+- name: add s3lphrepo
+  apt_repository:
+    repo: deb https://kernelpanic.lol/repo stable main
+
+- name: install inspircd
+  package:
+    name: inspircd
+
+- name: start and enable inspircd
+  service:
+    name: inspircd
+    state: started
+    enabled: yes
diff --git a/roles/inspircd/tasks/main.yml b/roles/inspircd/tasks/main.yml
new file mode 100644
index 0000000..c1df2a2
--- /dev/null
+++ b/roles/inspircd/tasks/main.yml
@@ -0,0 +1,11 @@
+---
+
+- import_tasks: install.yml
+  tags:
+    - "role::inspircd"
+    - "role::inspircd:install"
+
+- import_tasks: config.yml
+  tags:
+    - "role::inspircd"
+    - "role::inspircd:config"