Refactor app managment, add domains
This commit is contained in:
parent
f055ab5934
commit
9d44c18172
6 changed files with 44 additions and 27 deletions
14
README.md
14
README.md
|
@ -16,17 +16,21 @@ Example of Variables:
|
||||||
yunohost:
|
yunohost:
|
||||||
# Link to the install script
|
# Link to the install script
|
||||||
install_script_url: https://raw.githubusercontent.com/YunoHost/install_script/master/install_yunohost
|
install_script_url: https://raw.githubusercontent.com/YunoHost/install_script/master/install_yunohost
|
||||||
# The main domain
|
# The main domain, then a list of other domains.
|
||||||
domain: example.com
|
domain: example.com
|
||||||
|
extra_domains:
|
||||||
|
- example2.com
|
||||||
|
- example3.com
|
||||||
# Yunohost admin password
|
# Yunohost admin password
|
||||||
password: MYINSECUREPWD_PLZ_OVERRIDE_THIS
|
password: MYINSECUREPWD_PLZ_OVERRIDE_THIS
|
||||||
# If you don't want to use a noho.st url
|
# If you don't want to use a noho.st url
|
||||||
ignore_dyndns: False
|
ignore_dyndns: False
|
||||||
# The list of apps you want to install.
|
# The list of apps you want to install.
|
||||||
apps:
|
apps:
|
||||||
- link: ttrss # It can be the name of an official app or a github link
|
- label: Tiny Tiny RSS # Label is important, it's a reference for the Playbook.
|
||||||
args: # Provide here args. Path and domain are mandatory, other args depend of the app.
|
link: ttrss # It can be the name of an official app or a github link
|
||||||
path: /var/www/ttrss
|
args: # Provide here args. Path and domain are mandatory, other args depend of the app (cf manifest.json of app).
|
||||||
|
path: /ttrss
|
||||||
domain: example.com
|
domain: example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -48,7 +52,7 @@ Example Playbook
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: ansible-yunohost }
|
- { role: sylvainar.yunohost }
|
||||||
```
|
```
|
||||||
|
|
||||||
License
|
License
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
yunohost:
|
yunohost:
|
||||||
# Link to the install script
|
|
||||||
install_script_url: https://raw.githubusercontent.com/YunoHost/install_script/master/install_yunohost
|
install_script_url: https://raw.githubusercontent.com/YunoHost/install_script/master/install_yunohost
|
||||||
# The main domain
|
|
||||||
domain: example.com
|
domain: example.com
|
||||||
# Yunohost admin password
|
extra_domains: ~
|
||||||
password: MYINSECUREPWD_PLZ_OVERRIDE_THIS
|
password: MYINSECUREPWD_PLZ_OVERRIDE_THIS
|
||||||
# If you don't want to use a noho.st url
|
|
||||||
ignore_dyndns: False
|
ignore_dyndns: False
|
||||||
# The list of apps you want to install.
|
apps: ~
|
||||||
apps:
|
|
||||||
- link: ttrss # It can be the name of an official app or a github link
|
|
||||||
args: # Provide here args. Path and domain are mandatory, other args depend of the app.
|
|
||||||
path: /var/www/ttrss
|
|
||||||
domain: example.com
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
- name: Test if this app is already installed
|
|
||||||
stat: path={{ app.args.path }}
|
|
||||||
register: yunohost_app_installed
|
|
||||||
|
|
||||||
- name: Install app
|
|
||||||
shell: yunohost app install {{ app.link }} --args "{% for key, value in app.args.items() %}{{key}}={{value}}{% if not loop.last %}&{% endif %}{% endfor %}"
|
|
||||||
when: yunohost_app_installed.stat.exists == False
|
|
13
tasks/apps.yml
Normal file
13
tasks/apps.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
- name: List currently installed apps
|
||||||
|
shell: yunohost app map --output-as json
|
||||||
|
register: yunohost_installed_apps_raw
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Format json of apps
|
||||||
|
set_fact: yunohost_installed_apps="{{ yunohost_installed_apps_raw.stdout | from_json }}"
|
||||||
|
|
||||||
|
- name: Install apps
|
||||||
|
shell: yunohost app install {{ item.link }} --label "{{ item.label }}" --args "{% for key, value in item.args.items() %}{{key}}={{value}}{% if not loop.last %}&{% endif %}{% endfor %}"
|
||||||
|
with_items: "{{ yunohost.apps }}"
|
||||||
|
when: item.label not in yunohost_installed_apps.values()
|
13
tasks/domains.yml
Normal file
13
tasks/domains.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
- name: List currently installed domains
|
||||||
|
shell: yunohost domain list --output-as json
|
||||||
|
register: yunohost_installed_domains_raw
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Format json of domains
|
||||||
|
set_fact: yunohost_installed_domains="{{ yunohost_installed_domains_raw.stdout | from_json }}"
|
||||||
|
|
||||||
|
- name: Create domains
|
||||||
|
shell: yunohost domain add {{ item }} --admin-password {{ yunohost.password }}
|
||||||
|
with_items: "{{ yunohost.extra_domains }}"
|
||||||
|
when: item not in yunohost_installed_domains.domains
|
|
@ -30,11 +30,14 @@
|
||||||
"
|
"
|
||||||
when: yunohost_file_install.stat.exists == False
|
when: yunohost_file_install.stat.exists == False
|
||||||
|
|
||||||
|
- name: Create domains
|
||||||
|
include: domains.yml
|
||||||
|
when: yunohost.extra_domains
|
||||||
|
|
||||||
- name: Install certificates
|
- name: Install certificates
|
||||||
shell: "yunohost domain cert-install"
|
shell: yunohost domain cert-install
|
||||||
when: yunohost_file_install.stat.exists == False
|
changed_when: False
|
||||||
|
|
||||||
- name: Install apps
|
- name: Install apps
|
||||||
include: app.yml app={{item}}
|
include: apps.yml
|
||||||
with_items: "{{ yunohost.apps }}"
|
|
||||||
when: yunohost.apps
|
when: yunohost.apps
|
||||||
|
|
Loading…
Reference in a new issue