Commit 84f85580 authored by nono's avatar nono 💻
Browse files

Ajout des tâches

parent 606ae782
---
- name: Set the correct permissions to the container folder
become: yes
ansible.builtin.file:
path: "{{ discourse_install_path }}/containers"
state: directory
mode: '0700'
- name: Generate the Discourse configuration file
become: yes
template:
src: "templates/app.yml.j2"
dest: "{{ discourse_install_path }}/containers/app.yml"
register: discourse_app_config
- name: Set the correct permissions on the configuration file
become: yes
file:
path: "{{ discourse_install_path}}/containers/app.yml"
state: file
owner: discourse
group: www-data
mode: '0644'
---
- name: Check if Docker is installed
command: docker --version
register: docker_valid
ignore_errors: yes
- name: Debug Docker Output
debug:
var: docker_valid
- name: Fail if docker if not installed
fail:
msg: " Docker is not present on this system. Please include a Ansible role to install Docker before running this role."
when: docker_valid.failed
- name: Check variables
debug:
msg: "{{ discourse_home_path }} {{ discourse_forum_admin_user }}"
---
- name: Clone the repository with the Docker image
become: yes
ansible.builtin.git:
repo: https://github.com/discourse/discourse_docker.git
dest: "{{ discourse_install_path }}"
force: yes
- name: Check if the install path for Discourse is present
become: yes
file:
path: "{{ discourse_install_path }}"
state: directory
owner: discourse
group: www-data
mode: '0644'
- name: Check if the storage path for Discourse is present
become: yes
file:
path: "{{ discourse_storage_location }}"
state: directory
owner: discourse
group: www-data
mode: '0644'
- name: Check if the logs path for Discourse is present
become: yes
file:
path: "{{ discourse_log_location }}"
state: directory
owner: discourse
group: www-data
mode: '0644'
- name: The next action may take a while...
debug:
msg: "The next action will rebuild the assets and compile the application, time to make a tea."
- name: Rebuild and launch discourse
become: yes
command: ./launcher rebuild app
args:
chdir: "{{ discourse_install_path }}"
# when: discourse_app_config is changed
---
# tasks file for forum-lqdn
#
name: Setup requirements for Docker
name: Install Docker
- name: Prepare the dependencies for Discourse
import_tasks: dependencies.yml
name: Configure Docker
- name: Create the user account for Discourse
import_tasks: user.yml
name: Download Discourse
- name: Download Discourse
import_tasks: download.yml
name: Configure Discourse image
- name: Prepare the filesystem for Discourse
import_tasks: filesystem.yml
name: Build Discourse image
- name: Configure Discourse
import_tasks: configure.yml
name: Setup systemd for Discourse
- name: Install Discourse
import_tasks: install.yml
name: Run Discourse
- name: Run Discourse
import_tasks: run.yml
- name: Verify Discourse is running properly
import_tasks: post-install.yml
- name: Create API key
become: yes
shell: |
docker exec app rake 'api_key:create_master[ADMIN]' | tee apikey
args:
chdir: "{{ discourse_install_path }}"
creates: "{{ discourse_install_path }}/apikey"
- name: "Create {{ discourse_forum_user }} user"
become: yes
shell: |
set -ex
pass="{{ discourse_forum_admin_password }}" ; ( echo {{ discourse_forum_admin_user }} ; echo "$pass" ; echo "$pass" ; echo ) | docker exec -i app rake 'admin:create'
touch admin_exists
args:
chdir: "{{ discourse_install_path }}"
creates: "{{ discourse_install_path }}/admin_exists"
---
- name: Discourse group creation
become: yes
group:
name: discourse
state: present
# - name: www-data group creation
# become: yes
# group:
# name: www-data
# state: present
- name: Discourse user creation
become: yes
user:
name: discourse
groups:
- discourse
password: "!#" # Disabled user account
state: present
shell: /sbin/nologin
system: true
createhome: true
home: "{{ discourse_home_path }}"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment