diff --git a/README.md b/README.md index c29bb06b5e00d5ade3feca49cffd93e476177f06..23454b7bcb7e09c36d58eed8763097e392a36ab2 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,84 @@ -Role Name -========= +Funkwhale ansible role +====================== -A brief description of the role goes here. +An ansible role to install and update [Funkwhale](https://funkwhale.audio). -Requirements ------------- +Summary +------- + +Using this role, you can install and upgrade a Funkwhale pod, closely matching our [standard installation guide](https://docs.funkwhale.audio/installation/debian.html). The role will take care of: + +- Installing and configure dependencies and packages +- Install and configure PostgreSQL, Redis and Nginx (optional) +- Install and configure Funkwhale and it's dependencies +- Install and configure a SSL certificate with Let's Encrypt (optional) + +Usage +----- + +Add the following to your playbook: + +```yaml +- hosts: servers + roles: + - role: funkwhale + funkwhale_hostname: yourdomain.funkwhale + funkwhale_version: 0.18.3 + funkwhale_letsencrypt_email: contact@youremail.com +``` -Any pre-requisites that may not be covered by Ansible itself or the role should -be mentioned here. For instance, if the role uses the EC2 module, it may be a -good idea to mention in this section that the boto package is required. +See below for a full documentation on available variables. Role Variables -------------- -A description of the settable variables for this role should go here, including -any variables that are in defaults/main.yml, vars/main.yml, and any variables -that can/should be set via parameters to the role. Any variables that are read -from other roles and/or the global scope (ie. hostvars, group vars, etc.) should -be mentioned here as well. +**Required variables** + +| name | Example | Description | +| ----------------------------- | ----------------------------- | --------------------------------------------- | +| `funkwhale_hostname` | `yourdomain.funkwhale` | The domain name of your Funkwhale pod | +| `funkwhale_version` | `0.18.3` | The version to install/upgrade to. You can also use `develop` to run the development branch | +| `funkwhale_letsencrypt_email` | `contact@youremail.com` | The email to associate with your Let's Encrypt certificate (not needed if you set `funkwhale_letsencrypt_enabled: false`, see below) | + +**Optional variables** -Dependencies ------------- -A list of other roles hosted on Galaxy should go here, plus any details in -regards to parameters that may need to be set for other roles, or variables that -are used from other roles. +| name | Default | Description | +| --------------------------------------- | ----------------------------- | --------------------------------------------- | +| `funkwhale_api_ip` | `127.0.0.1` | IP adress to bind the Funkwhale server to | +| `funkwhale_api_port` | `5000` | Port to bind the Funkwhale server to | +| `funkwhale_config_path` | `/srv/funkwhale/config` | Path to Funkwhale's configuration directory | +| `funkwhale_database_managed` | `true` | If `true`, the role will manage the database server and Funkwhale's database | +| `funkwhale_database_name` | `funkwhale` | Name of the Funkwhale database to use | +| `funkwhale_database_user` | `funkwhale` | Postgresql username to login as | +| `funkwhale_env_vars` | `[]` | List of environment variables to append to the generated `.env` file. Example: `["AWS_ACCESS_KEY_ID=myawsid", "AWS_SECRET_ACCESS_KEY=myawskey"]` | +| `funkwhale_external_storage_enabled` | `false` | If `true`, set up the proper configuration to use an extenal storage for media files | +| `funkwhale_install_path` | `/srv/funkwhale` | Path were frontend, api and virtualenv files should be stored (**no trailing slash**) | +| `funkwhale_letsencrypt_certbot_flags` | `null` | Additional flags to pass to `certbot` | +| `funkwhale_letsencrypt_enabled` | `true` | If `true`, will configure SSL with certbot and Let's Encrypt | +| `funkwhale_media_path` | `/srv/funkwhale/data/media` | Path were audio and uploaded files should be stored (**no trailing slash**) | +| `funkwhale_music_path` | `/srv/funkwhale/data/music` | Path to your existing music library, to use with [CLI import](https://docs.funkwhale.audio/admin/importing-music.html) (**no trailing slash**) | +| `funkwhale_nginx_managed` | `true` | If `true`, will install and configure nginx | +| `funkwhale_nginx_max_body_size` | `100M` | Value of nginx's `max_body_size` parameter to use | +| `funkwhale_protocol` | `https` | If set to `https`, will configure Funkwhale and Nginx to work behind HTTPS. Use `http` to completely disable SSL. | +| `funkwhale_redis_managed` | `true` | If `true`, will install and configure redis | +| `funkwhale_ssl_cert_path` | `` | Path to an existing SSL certificate to use (use in combination with `funkwhale_letsencrypt_enabled: false`) | +| `funkwhale_ssl_key_path` | `` | Path to an existing SSL key to use (use in combination with `funkwhale_letsencrypt_enabled: false`) | +| `funkwhale_static_path` | `/srv/funkwhale/data/static` | Path were Funkwhale static files should be stored | +| `funkwhale_systemd_after` | `redis.service postgresql.service` | Configuration used for Systemd `After=` directive. Modify it if you have a database or redis server on a separate host | +| `funkwhale_systemd_service_name` | `funkwhale` | Name of the generated Systemd service, e.g when calling `systemctl start <xxx>` | +| `funkwhale_username` | `funkwhale` | Username of the system user and owner of Funkwhale data, files and configuration | -Example Playbook ----------------- +Supported platforms +------------------- -Including an example of how to use your role (for instance, with variables -passed in as parameters) is always nice for users too: +- Debian 9 +- More to come + +Dependencies +------------ - - hosts: servers - roles: - - { role: funkwhale, x: 42 } +This roles has no other dependencies. License ------- diff --git a/defaults/main.yml b/defaults/main.yml index 44ade7d42e19ed2fdef3146412bb3c014aeb53a1..ba9f403c6f3dd908c96981c8debedfb974d7bcab 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,6 +15,7 @@ funkwhale_nginx_max_body_size: 100M funkwhale_redis_managed: true funkwhale_api_ip: 127.0.0.1 funkwhale_api_port: 5000 +funkwhale_protocol: https funkwhale_settings_module: config.settings.production funkwhale_env_vars: [] funkwhale_systemd_after: redis.service postgresql.service diff --git a/meta/main.yml b/meta/main.yml index 4fa80a86af3092d23c54830d998c6b1c5fa2e7de..524d70e5e275f4a2b5fd807979f722c15f4fd947 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,12 +1,13 @@ --- galaxy_info: - author: Eliot Berriot + role_name: funkwhale + author: funkwhale description: An ansible role to install a Funkwhale server (https://funkwhale.audio) company: Funkwhale # If the issue tracker for your role is not on github, uncomment the # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker + issue_tracker_url: https://dev.funkwhale.audio/funkwhale/ansible/issues # Some suggested licenses: # - BSD (default) @@ -45,7 +46,14 @@ galaxy_info: # - 7 # - 99.99 - galaxy_tags: [] + galaxy_tags: + - music + - web + - python + - python + - nginx + - letsencrypt + - app # List tags for your role here, one per line. A tag is a keyword that describes # and categorizes the role. Users find roles by searching for tags. Be sure to # remove the '[]' above, if you add tags to this list. diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index b5dd19088bfb3463b33fa4d77546b54583c569ee..5e8a4df95c5804d00454b0002105bd7b5808d7e6 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -12,7 +12,6 @@ funkwhale_ssl_cert_path: /certs/test.crt funkwhale_ssl_key_path: /certs/test.key funkwhale_hostname: yourdomain.funkwhale - funkwhale_protocol: https funkwhale_version: 0.19.0-rc2 funkwhale_env_vars: - EMAIL_CONFIG=smtp+tls://user@:password@youremail.host:587