You've already forked ansible-directadmin
Bring role up to spec (2.5+, Debian 9) and introduce LetsEncrypt support (#5)
* Bring role up to spec (2.5+) and introduce LetsEncrypt support * Add Debian 9 support and fix script args chdir * Use correct schema for travis and use command instead of script * Make use of requirements.txt for build and fix syntax * Got better at reading the docs now * Minor improvements
This commit is contained in:
23
tasks/letsencrypt.yml
Normal file
23
tasks/letsencrypt.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: execute LetsEncrypt setup script
|
||||
command: letsencrypt.sh request_single {{ directadmin_hostname }} 4096
|
||||
args:
|
||||
chdir: /usr/local/directadmin/scripts/
|
||||
register: directadmin_letsencrypt_output
|
||||
|
||||
- debug:
|
||||
var: directadmin_letsencrypt_output.stdout_lines
|
||||
|
||||
- name: enable SSL with LetsEncrypt for DirectAdmin
|
||||
lineinfile:
|
||||
path: directadmin_config_path
|
||||
regexp: item.regexp
|
||||
line: item.line
|
||||
with_items:
|
||||
- { regexp: '^SSL\=0' , line: 'SSL=1' }
|
||||
- { regexp: '^carootcert=' , line: 'carootcert=/usr/local/directadmin/conf/carootcert.pem' }
|
||||
- { regexp: '^force_hostname=' , line: "force_hostname={{ directadmin_hostname }}" }
|
||||
- { regexp: '^ssl_redirect_host=' , line: "ssl_redirect_host={{ directadmin_hostname }}" }
|
||||
- { regexp: '^letsencrypt=' , line: "letsencrypt=1" }
|
||||
notify:
|
||||
- restart directadmin
|
||||
@@ -7,7 +7,9 @@
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ directadmin_debian6_packages }}"
|
||||
when: "ansible_distribution == 'Debian' and ansible_distribution_release == 'squeeze'"
|
||||
when:
|
||||
- ansible_distribution == 'Debian'
|
||||
- ansible_distribution_release == 'squeeze'
|
||||
|
||||
- name: Install dependencies for Debian 7 Wheezy
|
||||
apt:
|
||||
@@ -17,7 +19,9 @@
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ directadmin_debian7_packages }}"
|
||||
when: "ansible_distribution == 'Debian' and ansible_distribution_release == 'wheezy'"
|
||||
when:
|
||||
- ansible_distribution == 'Debian'
|
||||
- ansible_distribution_release == 'wheezy'
|
||||
|
||||
- name: Install dependencies for Debian 8 Jessie
|
||||
apt:
|
||||
@@ -26,5 +30,19 @@
|
||||
cache_valid_time: "{{ directadmin_cache_timeout }}"
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ directadmin_debian8_packages }}"
|
||||
when: "ansible_distribution == 'Debian' and ansible_distribution_release == 'jessie'"
|
||||
- "{{ directadmin_debian9_packages }}"
|
||||
when:
|
||||
- ansible_distribution == 'Debian'
|
||||
- ansible_distribution_release == 'jessie'
|
||||
|
||||
- name: Install dependencies for Debian 9 Stretch
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
update_cache: yes
|
||||
cache_valid_time: "{{ directadmin_cache_timeout }}"
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ directadmin_debian8_packages }}"
|
||||
when:
|
||||
- ansible_distribution == 'Debian'
|
||||
- ansible_distribution_release == 'jessie'
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
update_cache: yes
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ directadmin_rhel_packages_generic }}"
|
||||
- "{{ directadmin_rhel_generic_packages }}"
|
||||
|
||||
- name: install everywhere but on CentOS7
|
||||
yum:
|
||||
@@ -14,7 +14,9 @@
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ directadmin_rhel_packages }}"
|
||||
when: ansible_distribution not 'CentOS' and ansible_distribution_version|version_compare('ne', 7)
|
||||
when:
|
||||
- ansible_distribution not 'CentOS'
|
||||
- ansible_distribution_version is version(7, 'ne')
|
||||
|
||||
- name: install CentOS 7 specific requirements
|
||||
yum:
|
||||
@@ -23,4 +25,6 @@
|
||||
state: present
|
||||
with_items:
|
||||
- "{{ directadmin_centos7_packages }}"
|
||||
when: ansible_distribution == 'CentOS' and ansible_distribution_version|version_compare('=', 7)
|
||||
when:
|
||||
- ansible_distribution is 'CentOS'
|
||||
- ansible_distribution_version is version(7, '=')
|
||||
|
||||
@@ -14,16 +14,15 @@
|
||||
src: .custombuild.j2
|
||||
dest: "{{ directadmin_setup_path }}/.custombuild"
|
||||
|
||||
- name: check if DA is already running on host
|
||||
uri:
|
||||
url: http://localhost:2222
|
||||
return_content: no
|
||||
register: da_present
|
||||
- name: check if DA is already present on host
|
||||
stat:
|
||||
path: "{{ directadmin_config_path }}"
|
||||
register: directadmin_present
|
||||
|
||||
- name: toggle whether to install DA or not
|
||||
set_fact:
|
||||
directadmin_install: False
|
||||
when: da_present.status == 200
|
||||
when: directadmin_present.stat.exists == True
|
||||
|
||||
- block:
|
||||
- name: ensure directadmin path if remote options file is used
|
||||
@@ -54,6 +53,10 @@
|
||||
var: setup_output.stdout_lines
|
||||
when: directadmin_install
|
||||
|
||||
- name: ensure Letsencrypt
|
||||
include: letsencrypt.yml
|
||||
when: directadmin_letsencrypt
|
||||
|
||||
- debug:
|
||||
msg: "Directadmin is already installed and running, skipping.."
|
||||
when: not directadmin_install
|
||||
|
||||
Reference in New Issue
Block a user