Merge pull request #1 from TheRojam/upgrade/ansible_version_3
Upgrade/ansible version 3
This commit is contained in:
commit
9220e1cdba
6 changed files with 25 additions and 23 deletions
|
@ -1,7 +1,7 @@
|
||||||
ansible-yunohost
|
ansible-yunohost
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Deploy Yunohost with Ansible !
|
Deploy Yunohost with Ansible!
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
@ -54,7 +54,7 @@ Example Playbook
|
||||||
remote_user: root
|
remote_user: root
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Update all packages and index
|
- name: Update all packages and index
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
upgrade: dist
|
upgrade: dist
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
|
role_name: yunohost
|
||||||
author: sylvainar
|
author: sylvainar
|
||||||
description: Deploy Yunohost with Ansible
|
description: Deploy Yunohost with Ansible
|
||||||
license: GPL-v3
|
license: GPL-v3
|
||||||
min_ansible_version: 1.2
|
min_ansible_version: 2.10
|
||||||
galaxy_tags: [yunohost]
|
galaxy_tags: [yunohost]
|
||||||
platforms:
|
platforms:
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
- jessie
|
- jessie
|
||||||
|
- buster
|
||||||
categories:
|
categories:
|
||||||
- cloud
|
- cloud
|
||||||
- web
|
- web
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
---
|
---
|
||||||
- name: List currently installed apps
|
- name: List currently installed apps
|
||||||
shell: yunohost app map --output-as json
|
ansible.builtin.shell: yunohost app map --output-as json
|
||||||
register: yunohost_installed_apps_raw
|
register: yunohost_installed_apps_raw
|
||||||
changed_when: False
|
changed_when: False
|
||||||
|
|
||||||
- name: Format json of apps
|
- name: Format json of apps
|
||||||
set_fact: yunohost_installed_apps="{{ yunohost_installed_apps_raw.stdout | from_json }}"
|
ansible.builtin.set_fact: yunohost_installed_apps="{{ yunohost_installed_apps_raw.stdout | from_json }}"
|
||||||
|
|
||||||
- name: Install apps
|
- 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 %}"
|
ansible.builtin.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 }}"
|
with_items: "{{ yunohost.apps }}"
|
||||||
when: item.label not in yunohost_installed_apps.values()
|
when: item.label not in yunohost_installed_apps.values()
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
---
|
---
|
||||||
- name: List currently installed domains
|
- name: List currently installed domains
|
||||||
shell: yunohost domain list --output-as json
|
ansible.builtin.shell: yunohost domain list --output-as json
|
||||||
register: yunohost_installed_domains_raw
|
register: yunohost_installed_domains_raw
|
||||||
changed_when: False
|
changed_when: False
|
||||||
|
|
||||||
- name: Format json of domains
|
- name: Format json of domains
|
||||||
set_fact: yunohost_installed_domains="{{ yunohost_installed_domains_raw.stdout | from_json }}"
|
ansible.builtin.set_fact: yunohost_installed_domains="{{ yunohost_installed_domains_raw.stdout | from_json }}"
|
||||||
|
|
||||||
- name: Create domains
|
- name: Create domains
|
||||||
shell: yunohost domain add {{ item }}
|
ansible.builtin.shell: yunohost domain add {{ item }}
|
||||||
with_items: "{{ yunohost.extra_domains }}"
|
with_items: "{{ yunohost.extra_domains }}"
|
||||||
when: item not in yunohost_installed_domains.domains
|
when: item not in yunohost_installed_domains.domains
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
---
|
---
|
||||||
- name: Install requirements
|
- name: Install requirements
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name:
|
name:
|
||||||
- git
|
- git
|
||||||
- dialog
|
- dialog
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Test if Yunohost is already installed
|
- name: Test if Yunohost is already installed
|
||||||
stat: path=/etc/yunohost/installed
|
ansible.builtin.stat: path=/etc/yunohost/installed
|
||||||
register: yunohost_file_install
|
register: yunohost_file_install
|
||||||
|
|
||||||
- name: Download install script
|
- name: Download install script
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ yunohost.install_script_url }}"
|
url: "{{ yunohost.install_script_url }}"
|
||||||
dest: /tmp/install_yunohost.sh
|
dest: /tmp/install_yunohost.sh
|
||||||
mode: 700
|
mode: 700
|
||||||
when: yunohost_file_install.stat.exists == False
|
when: yunohost_file_install.stat.exists == False
|
||||||
|
|
||||||
- name: Launch script
|
- name: Launch script
|
||||||
command: /tmp/install_yunohost.sh -a
|
ansible.builtin.command: /tmp/install_yunohost.sh -a
|
||||||
when: yunohost_file_install.stat.exists == False
|
when: yunohost_file_install.stat.exists == False
|
||||||
|
|
||||||
- name: Launch postinsstall
|
- name: Launch postinsstall
|
||||||
shell: "
|
ansible.builtin.shell: "
|
||||||
yunohost tools postinstall \
|
yunohost tools postinstall \
|
||||||
--domain {{ yunohost.domain }} \
|
--domain {{ yunohost.domain }} \
|
||||||
--password {{ yunohost.password }} \
|
--password {{ yunohost.password }} \
|
||||||
|
@ -31,20 +31,20 @@
|
||||||
when: yunohost_file_install.stat.exists == False
|
when: yunohost_file_install.stat.exists == False
|
||||||
|
|
||||||
- name: Create domains
|
- name: Create domains
|
||||||
include: domains.yml
|
ansible.builtin.include: domains.yml
|
||||||
when: yunohost.extra_domains
|
when: yunohost.extra_domains
|
||||||
|
|
||||||
- name: Run diagnosis # Required to install certificates
|
- name: Run diagnosis # Required to install certificates
|
||||||
shell: yunohost diagnosis run
|
ansible.builtin.shell: yunohost diagnosis run
|
||||||
|
|
||||||
- name: Install certificates
|
- name: Install certificates
|
||||||
shell: yunohost domain cert-install
|
ansible.builtin.shell: yunohost domain cert-install
|
||||||
changed_when: False
|
changed_when: False
|
||||||
|
|
||||||
- name: Add users
|
- name: Add users
|
||||||
include: users.yml
|
ansible.builtin.include: users.yml
|
||||||
when: yunohost.users
|
when: yunohost.users
|
||||||
|
|
||||||
- name: Install apps
|
- name: Install apps
|
||||||
include: apps.yml
|
ansible.builtin.include: apps.yml
|
||||||
when: yunohost.apps
|
when: yunohost.apps
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
---
|
---
|
||||||
- name: List users
|
- name: List users
|
||||||
shell: yunohost user list --output-as json
|
ansible.builtin.shell: yunohost user list --output-as json
|
||||||
register: yunohost_registered_users_raw
|
register: yunohost_registered_users_raw
|
||||||
changed_when: False
|
changed_when: False
|
||||||
|
|
||||||
- name: Format json of users
|
- name: Format json of users
|
||||||
set_fact: yunohost_registered_users="{{ yunohost_registered_users_raw.stdout | from_json }}"
|
ansible.builtin.set_fact: yunohost_registered_users="{{ yunohost_registered_users_raw.stdout | from_json }}"
|
||||||
|
|
||||||
- name: Create missing users
|
- name: Create missing users
|
||||||
shell: |
|
ansible.builtin.shell: |
|
||||||
yunohost user create {{ item.name }} \
|
yunohost user create {{ item.name }} \
|
||||||
-f {{ item.firstname }} \
|
-f {{ item.firstname }} \
|
||||||
-l {{ item.lastname }} \
|
-l {{ item.lastname }} \
|
||||||
-m {{ item.mail }} \
|
-m {{ item.mail }} \
|
||||||
-p {{ item.pass }}
|
-p {{ item.pass }}
|
||||||
with_items: "{{ yunohost.users }}"
|
loop: "{{ yunohost.users }}"
|
||||||
when: item.name not in yunohost_registered_users.users.keys()
|
when: item.name not in yunohost_registered_users.users.keys()
|
||||||
|
|
Loading…
Reference in a new issue