Verified Commit 4869fa83 authored by mal's avatar mal
Browse files

Fix Gitlab CI, lint, start updating to molecule 3

parent 95b090c9
Pipeline #15978 passed with stage
in 9 minutes and 57 seconds
---
stages:
- test
- deploy
......
---
extends: default
rules:
......
......@@ -23,7 +23,7 @@ funkwhale_database_port: 5432
# ↓ Only needed if 'funkwhale_database_managed' == false
# ↓ This is also assuming DB and user have already been set up, outside of the playbook.
# ↓ Considering the playbook handles both local and remote PostGreSQL server types, this should typically not be required.
#funkwhale_database_url: postgresql://{{ funkwhale_database_user }}[:{{ funkwhale_database_password }}]@[{{ funkwhale_database_host_app }}]:{{ funkwhale_database_port | default(5432) }}/{{ funkwhale_database_name }}
# funkwhale_database_url: postgresql://{{ funkwhale_database_user }}[:{{ funkwhale_database_password }}]@[{{ funkwhale_database_host_app }}]:{{ funkwhale_database_port | default(5432) }}/{{ funkwhale_database_name }}
funkwhale_nginx_managed: true
# If you have an HTTPS reverse proxy higher up, set this to true
......
......@@ -216,9 +216,9 @@ do_install() {
init_ansible() {
echo "[2/$total_steps] Installing ansible dependencies..."
install_packages curl git python3-pip python3-apt sudo locales locales-all
install_packages curl git python3-pip python3-apt python3-psycopg2 sudo locales locales-all
echo "[2/$total_steps] Installing Ansible..."
pip3 install --user ansible=="$ansible_version" psycopg2-binary
pip3 install --user ansible=="$ansible_version"
echo "[2/$total_steps] Creating ansible configuration files in $ansible_conf_path..."
mkdir -p "$ansible_conf_path"
......
......@@ -54,12 +54,12 @@ galaxy_info:
- 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.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
# 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.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
......
......@@ -6,7 +6,7 @@ FROM {{ item.registry.url }}/{{ item.image }}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python3 python3-setuptools sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
......
......@@ -3,11 +3,13 @@ dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
lint: |
yamllint .
ansible-lint
#flake8
platforms:
- name: debian-stretch
image: alehaa/debian-systemd:stretch
- name: debian-buster
image: alehaa/debian-systemd:buster
command: /sbin/init
tmpfs:
- /run
......@@ -17,11 +19,10 @@ platforms:
provisioner:
name: ansible
lint:
name: ansible-lint
inventory:
host_vars:
debian-buster:
ansible_python_interpreter: "/usr/bin/python3"
verifier:
name: testinfra
lint:
name: flake8
enabled: False
......@@ -31,7 +31,7 @@
login_user: postgres
delegate_to: "{{ funkwhale_database_host_ansible or inventory_hostname }}"
- name: "Create {{ funkwhale_database_name }} database on {{ funkwhale_database_host_ansible or inventory_hostname}}"
- name: "Create {{ funkwhale_database_name }} database on {{ funkwhale_database_host_ansible or inventory_hostname }}"
become: true
become_user: postgres
when: funkwhale_database_managed
......
......@@ -18,7 +18,9 @@
file:
path: "{{ item }}"
owner: "{{ funkwhale_username }}"
group: "{{ funkwhale_username }}"
state: directory
mode: '755'
with_items:
- "{{ funkwhale_install_path }}"
- "{{ funkwhale_media_path }}"
......@@ -26,25 +28,26 @@
- "{{ funkwhale_music_path }}"
- "{{ funkwhale_config_path }}"
- name: Check if django_secret_key file is setup
- name: Check if django_secret_key file is set up
stat:
path: "{{ funkwhale_config_path }}/django_secret_key"
register: "result_django_secret_key"
- name: "Generate a random secret key"
when: result_django_secret_key.stat.exists == False
when: not result_django_secret_key.stat.exists
become: true
become_user: "{{ funkwhale_username }}"
command: "openssl rand -hex 25"
register: result_secret_key_generation
- name: "Create django_secret_key file"
when: not ansible_check_mode and result_django_secret_key.stat.exists == False
when: not ansible_check_mode and not result_django_secret_key.stat.exists
become: true
become_user: "{{ funkwhale_username }}"
copy:
content: "{{ result_secret_key_generation.stdout }}"
dest: "{{ funkwhale_config_path }}/django_secret_key"
mode: '600'
- name: "Setup a dummy secret key"
when: ansible_check_mode
......
......@@ -26,12 +26,12 @@
when: funkwhale_nginx_managed and funkwhale_letsencrypt_enabled
become: true
command: snap install core
- name: Refresh core snap before installing certbot
when: funkwhale_nginx_managed and funkwhale_letsencrypt_enabled
become: true
command: snap refresh core
- name: Install certbot snap
when: funkwhale_nginx_managed and funkwhale_letsencrypt_enabled
become: true
......@@ -40,7 +40,7 @@
- name: Link certbot snap installation
when: funkwhale_nginx_managed and funkwhale_letsencrypt_enabled
become: true
file:
file:
src: /snap/bin/certbot
dest: /usr/bin/certbot
state: link
......@@ -66,6 +66,7 @@
template:
src: funkwhale_proxy.conf.j2
dest: "/etc/nginx/funkwhale_proxy.conf"
mode: '644'
notify:
- reload nginx
......@@ -75,5 +76,6 @@
template:
src: nginx.conf.j2
dest: "/etc/nginx/sites-enabled/{{ funkwhale_hostname }}.conf"
mode: '644'
notify:
- reload nginx
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