From 1578eb74ba524841e93881cf58d474150878ce32 Mon Sep 17 00:00:00 2001 From: sylvainar Date: Wed, 23 Aug 2017 12:58:21 +0200 Subject: [PATCH] Install yunohost --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++- default/main.yml | 11 ++++++++++ meta/main.yml | 11 ++++++++++ tasks/main.yml | 35 ++++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 default/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/main.yml diff --git a/README.md b/README.md index 7155d35..28e69c8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,53 @@ -# ansible-yunohost +ansible-yunohost +========= + Deploy Yunohost with Ansible ! + +Requirements +------------ + +None. + +Role Variables +-------------- + +Example of Variables: +```yml +yunohost: + # Link to the install script + install_script_url: https://raw.githubusercontent.com/YunoHost/install_script/master/install_yunohost + # The main domain + domain: mydomain.fr + # Yunohost admin password + password: MYINSECUREPWD_PLZ_OVERRIDE_THIS + # If you don't want to use a noho.st url + ignore_dyndns: False + # The list of apps you want to install (not working yet). + apps: ~ +``` + +Dependencies +------------ + +None. + +Example Playbook +---------------- +```yml +- name: Provision servers + hosts: all + remote_user: root + pre_tasks: + - name: Update all packages and index + apt: + upgrade: dist + update_cache: yes + + roles: + - { role: ansible-yunohost } +``` + +License +------- + +GPL-3.0 diff --git a/default/main.yml b/default/main.yml new file mode 100644 index 0000000..4666f3c --- /dev/null +++ b/default/main.yml @@ -0,0 +1,11 @@ +yunohost: + # Link to the install script + install_script_url: https://raw.githubusercontent.com/YunoHost/install_script/master/install_yunohost + # The main domain + domain: mydomain.fr + # Yunohost admin password + password: MYINSECUREPWD_PLZ_OVERRIDE_THIS + # If you don't want to use a noho.st url + ignore_dyndns: False + # The list of apps you want to install (not working yet). + apps: ~ diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..5839c83 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,11 @@ +galaxy_info: + author: sylvainar + description: Deploy Yunohost with Ansible + + license: GPL-v3 + + min_ansible_version: 1.2 + + galaxy_tags: [yunohost] + +dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..2e5e939 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,35 @@ +--- +- name: Install requirements + apt: + name: + - git + - dialog + state: present + +- name: Test if Yunohost is already installed + stat: path=/etc/yunohost/installed + register: yunohost_file_install + +- name: Download install script + get_url: + url: "{{ yunohost.install_script_url }}" + dest: /tmp/install_yunohost.sh + mode: 700 + when: yunohost_file_install.stat.exists == False + +- name: Launch script + command: /tmp/install_yunohost.sh -a + when: yunohost_file_install.stat.exists == False + +- name: Launch postinsstall + shell: " + yunohost tools postinstall \ + --domain {{ yunohost.domain }} \ + --password {{ yunohost.password }} \ + {% if yunohost.ignore_dyndns == True %} --ignore-dyndns {% endif %} + " + when: yunohost_file_install.stat.exists == False + +- name: Install certificates + shell: "yunohost domain cert-install" + when: yunohost_file_install.stat.exists == False