2017-08-23 12:58:21 +02:00
|
|
|
---
|
2021-10-19 10:29:57 +02:00
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# ansible-yunohost allows to deploy Yunohost using Ansible #
|
2022-01-27 11:55:40 +01:00
|
|
|
# Copyright 2021-present Lydra https://www.lydra.fr/ #
|
2021-10-19 10:29:57 +02:00
|
|
|
# #
|
|
|
|
# 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, either version 3 of the License, or #
|
|
|
|
# (at your option) any later version. #
|
|
|
|
# #
|
|
|
|
# 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 <http://www.gnu.org/licenses/>. #
|
|
|
|
# #
|
|
|
|
#-----------------------------------------------------------------------------#
|
2022-02-16 13:57:59 +01:00
|
|
|
- name: Update all packages and index
|
|
|
|
ansible.builtin.apt:
|
|
|
|
upgrade: dist
|
|
|
|
update_cache: yes
|
|
|
|
tags:
|
|
|
|
- pkg
|
|
|
|
- linux
|
2021-10-19 10:29:57 +02:00
|
|
|
|
2017-08-23 12:58:21 +02:00
|
|
|
- name: Install requirements
|
2021-05-01 17:13:18 +02:00
|
|
|
ansible.builtin.apt:
|
2017-08-23 12:58:21 +02:00
|
|
|
name:
|
|
|
|
- git
|
|
|
|
- dialog
|
|
|
|
state: present
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- pkg
|
|
|
|
- linux
|
|
|
|
|
2022-06-23 16:44:14 +02:00
|
|
|
- name: Create backup directory
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "/home/yunohost.backup/archives"
|
|
|
|
state: directory
|
|
|
|
mode: "0755"
|
|
|
|
tags:
|
|
|
|
- linux
|
|
|
|
when: ynh_data_dirs_enabled
|
|
|
|
|
2022-02-03 13:41:56 +01:00
|
|
|
- name: Create data and config subdirs of Yunohost
|
2022-01-27 11:55:40 +01:00
|
|
|
ansible.builtin.file:
|
2022-02-03 13:41:56 +01:00
|
|
|
path: "{{ item.path }}"
|
2022-01-27 11:55:40 +01:00
|
|
|
state: directory
|
2022-02-03 13:41:56 +01:00
|
|
|
mode: "0755"
|
|
|
|
with_items:
|
|
|
|
- "{{ ynh_data_dirs }}"
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- linux
|
2022-02-03 13:41:56 +01:00
|
|
|
when: ynh_data_dirs_enabled
|
2022-01-27 11:55:40 +01:00
|
|
|
|
2022-02-03 13:41:56 +01:00
|
|
|
- name: Create symbolic links for Yunohost subdirs
|
2022-01-27 11:55:40 +01:00
|
|
|
ansible.builtin.file:
|
2022-02-03 13:41:56 +01:00
|
|
|
src: "{{ item.path }}"
|
|
|
|
dest: "{{ item.link }}"
|
2022-01-27 11:55:40 +01:00
|
|
|
state: link
|
2022-06-23 16:44:14 +02:00
|
|
|
force: yes
|
2022-02-03 13:41:56 +01:00
|
|
|
with_items:
|
2022-02-16 13:57:59 +01:00
|
|
|
- "{{ ynh_data_dirs }}"
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- linux
|
2022-02-03 13:41:56 +01:00
|
|
|
when: ynh_data_dirs_enabled
|
2017-08-23 12:58:21 +02:00
|
|
|
|
|
|
|
- name: Test if Yunohost is already installed
|
2021-05-01 17:13:18 +02:00
|
|
|
ansible.builtin.stat: path=/etc/yunohost/installed
|
2021-10-12 14:27:37 +02:00
|
|
|
register: ynh_file_install
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- yunohost
|
2017-08-23 12:58:21 +02:00
|
|
|
|
2021-10-12 14:27:37 +02:00
|
|
|
- name: Download Yunohost install script
|
2021-05-01 17:13:18 +02:00
|
|
|
ansible.builtin.get_url:
|
2021-10-12 14:27:37 +02:00
|
|
|
url: "{{ ynh_install_script_url }}"
|
2017-08-23 12:58:21 +02:00
|
|
|
dest: /tmp/install_yunohost.sh
|
|
|
|
mode: 700
|
2021-10-13 18:02:27 +02:00
|
|
|
when: not ynh_file_install.stat.exists
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- yunohost
|
2017-08-23 12:58:21 +02:00
|
|
|
|
2021-10-12 14:27:37 +02:00
|
|
|
- name: Launch Yunohost install script
|
2021-05-01 17:13:18 +02:00
|
|
|
ansible.builtin.command: /tmp/install_yunohost.sh -a
|
2021-10-13 18:02:27 +02:00
|
|
|
when: not ynh_file_install.stat.exists
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- yunohost
|
2017-08-23 12:58:21 +02:00
|
|
|
|
2021-10-12 14:27:37 +02:00
|
|
|
- name: Launch Yunohost postinstall
|
2021-10-12 16:00:56 +02:00
|
|
|
ansible.builtin.command:
|
2017-08-23 12:58:21 +02:00
|
|
|
yunohost tools postinstall \
|
2021-10-12 16:00:56 +02:00
|
|
|
--domain "{{ ynh_main_domain }}" \
|
|
|
|
--password "{{ ynh_admin_password }}" \
|
2021-10-13 18:02:27 +02:00
|
|
|
{% if ynh_ignore_dyndns_server %} --ignore-dyndns {% endif %}
|
|
|
|
when: not ynh_file_install.stat.exists
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- yunohost
|
|
|
|
- domains
|
2017-08-23 12:58:21 +02:00
|
|
|
|
2021-10-12 14:27:37 +02:00
|
|
|
- name: Create extra domains
|
2021-10-12 16:34:35 +02:00
|
|
|
ansible.builtin.include_tasks: domains.yml
|
2021-10-12 14:27:37 +02:00
|
|
|
when: ynh_extra_domains
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- yunohost
|
|
|
|
- domains
|
2017-08-24 22:39:58 +02:00
|
|
|
|
2021-10-12 14:27:37 +02:00
|
|
|
- name: Run first Yunohost diagnosis
|
2021-10-12 16:00:56 +02:00
|
|
|
ansible.builtin.command: yunohost diagnosis run
|
2021-10-13 18:02:27 +02:00
|
|
|
when: not ynh_file_install.stat.exists
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- yunohost
|
2020-11-16 07:52:20 +01:00
|
|
|
|
2021-10-12 14:27:37 +02:00
|
|
|
- name: Install domain certificates
|
2021-10-12 16:00:56 +02:00
|
|
|
ansible.builtin.command: yunohost domain cert-install
|
2017-08-24 22:39:58 +02:00
|
|
|
changed_when: False
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- yunohost
|
2021-10-26 15:52:28 +02:00
|
|
|
|
2021-10-12 14:27:37 +02:00
|
|
|
- name: Add Yunohost users
|
2021-10-12 16:34:35 +02:00
|
|
|
ansible.builtin.include_tasks: users.yml
|
2021-10-12 14:27:37 +02:00
|
|
|
when: ynh_users
|
2022-01-27 11:55:40 +01:00
|
|
|
tags:
|
|
|
|
- yunohost
|
|
|
|
- users
|