You've already forked ansible-role-directadmin
Initial commit
This commit is contained in:
109
tasks/main.yml
Normal file
109
tasks/main.yml
Normal file
@@ -0,0 +1,109 @@
|
||||
---
|
||||
|
||||
- name: Check if DirectAdmin exists
|
||||
stat:
|
||||
path: /usr/local/directadmin/directadmin
|
||||
register: da
|
||||
|
||||
- name: Configure pre-install options
|
||||
when: not da.stat.exists
|
||||
block:
|
||||
- name: Ensure custombuild directory exists
|
||||
file:
|
||||
path: "{{ directadmin_custombuild_path }}"
|
||||
state: directory
|
||||
|
||||
- name: Setup options for base install
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- name: options.conf
|
||||
src: custombuild/options.conf.j2
|
||||
dest: "{{ directadmin_custombuild_path }}/options.conf"
|
||||
- name: php_extensions.conf
|
||||
src: custombuild/php_extensions.conf.j2
|
||||
dest: "{{ directadmin_custombuild_path }}/php_extensions.conf"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
# vars:
|
||||
# directadmin_webserver: apache # Ensure is apache install for server name SSL
|
||||
|
||||
- name: Download DirectAdmin installer
|
||||
get_url:
|
||||
url: https://download.directadmin.com/setup.sh
|
||||
dest: /tmp/directadmin-setup.sh
|
||||
mode: "0700"
|
||||
|
||||
- name: 'Coffee Time!'
|
||||
debug:
|
||||
msg: "Have a nice break, I'll be busy a while..."
|
||||
|
||||
- name: Send ntfy ping
|
||||
uri:
|
||||
url: https://ntfy.cybercinch.nz/
|
||||
method: POST
|
||||
body_format: json
|
||||
body:
|
||||
topic: ansiballz
|
||||
title: DirectAdmin provisioning
|
||||
tags:
|
||||
- robot
|
||||
- warning
|
||||
- cd
|
||||
message: DirectAdmin install is beginning on {{ inventory_hostname }}
|
||||
|
||||
- name: Run installer
|
||||
shell: "{{ lookup('ansible.builtin.template', 'templates/cli/directadmin-setup.j2') }}"
|
||||
|
||||
- name: Send ntfy ping
|
||||
uri:
|
||||
url: https://ntfy.cybercinch.nz/
|
||||
method: POST
|
||||
body_format: json
|
||||
body:
|
||||
topic: ansiballz
|
||||
title: DirectAdmin provisioning
|
||||
tags:
|
||||
- robot
|
||||
- heavy_check_mark
|
||||
message: DirectAdmin install is completed on {{ inventory_hostname }}
|
||||
|
||||
- name: Add new IPv6 to DA
|
||||
template:
|
||||
src: da-ip.j2
|
||||
dest: /usr/local/directadmin/data/admin/ips/{{ hostvars[inventory_hostname]['ansible_default_ipv6']['address'] }}
|
||||
owner: diradmin
|
||||
group: diradmin
|
||||
mode: "0600"
|
||||
notify:
|
||||
- Restart DirectAdmin
|
||||
- Rewrite confs
|
||||
|
||||
- name: Reciprocal Link from Main IPv4
|
||||
lineinfile:
|
||||
path: /usr/local/directadmin/data/admin/ips/{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address']}}
|
||||
line: "linked_ips={{ hostvars[inventory_hostname]['ansible_default_ipv6']['address'] | encode_ip }}=apache%3Dyes%26dns%3Dyes"
|
||||
create: true
|
||||
notify:
|
||||
- Restart DirectAdmin
|
||||
- Rewrite confs
|
||||
|
||||
- name: Add IP to admin ip.list
|
||||
ansible.builtin.lineinfile:
|
||||
path: /usr/local/directadmin/data/admin/ip.list
|
||||
line: "{{ hostvars[inventory_hostname]['ansible_default_ipv6']['address'] }}"
|
||||
create: true
|
||||
notify:
|
||||
- Restart DirectAdmin
|
||||
- Rewrite confs
|
||||
|
||||
- name: Flushing handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: Get Server Hostname SSL Certificate
|
||||
import_tasks: letsencrypt.yml
|
||||
|
||||
# Tasks which can run whether new install or just config
|
||||
- name: Include configuration tasks
|
||||
include_tasks: config.yml
|
||||
Reference in New Issue
Block a user