Skip to content
Snippets Groups Projects
Commit 8247f38b authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-playbooks/general#85 Linting

parent a6c6b1e2
No related branches found
No related tags found
No related merge requests found
matomo_version: '3.9.1' matomo_version: 3.9.1
matomo_force_reset: False matomo_force_reset: False
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
- block: - block:
- name: "Apache Configuration File" - name: Apache Configuration File
template: template:
src='vhost.conf' src='vhost.conf'
dest='/etc/apache2/sites-available/{{ matomo.domain }}{{ apache_conf_ext }}' dest='/etc/apache2/sites-available/{{ matomo.domain }}{{ apache_conf_ext }}'
...@@ -13,14 +13,15 @@ ...@@ -13,14 +13,15 @@
notify: notify:
- "Apache | Restart Apache" - "Apache | Restart Apache"
- name: "Apache enable our new site(s)" - name: Apache enable our new site(s)
command: a2ensite {{ matomo.domain }} creates=/etc/apache2/sites-enabled/{{ matomo.domain }}{{ apache_conf_ext }} command: a2ensite {{ matomo.domain }} creates=/etc/apache2/sites-enabled/{{ matomo.domain }}{{ apache_conf_ext }}
notify: notify:
- "Apache | Restart Apache" - "Apache | Restart Apache"
- name: "Apache install GeoIP" - name: Apache install GeoIP
apt: apt:
pkg: 'libapache2-mod-geoip' pkg: libapache2-mod-geoip
state: 'present' state: present
tags: 'ApacheConfig' tags:
- ApacheConfig
...@@ -12,22 +12,25 @@ ...@@ -12,22 +12,25 @@
apacheUser='{{ matomo.id }}' apacheUser='{{ matomo.id }}'
apacheLogDir='{{ jailroot }}/{{ matomo.id }}/var/log/apache2' apacheLogDir='{{ jailroot }}/{{ matomo.id }}/var/log/apache2'
when: matomo.jail is defined when: matomo.jail is defined
tags: 'always' tags:
- always
- name: "Configure Apache" - name: Configure Apache
include_tasks: apache.yml include_tasks: apache.yml
tags: 'ApacheConfig' tags:
- ApacheConfig
- name: "Remove existing components" - name: Remove existing components
file: file:
path: '{{ item }}' path: '{{ item }}'
state: 'absent' state: absent
with_items: with_items:
- '{{ webRoot }}' - {{ webRoot }}
when: matomo_force_reset when: matomo_force_reset
tags: 'always' tags:
- always
- name: "Ensure Root Directories" - name: Ensure Root Directories
file: file:
path='{{ item }}' path='{{ item }}'
state='directory' state='directory'
...@@ -35,10 +38,11 @@ ...@@ -35,10 +38,11 @@
group='{{ apacheUser }}' group='{{ apacheUser }}'
mode='775' mode='775'
with_items: with_items:
- '{{ webRoot }}' - {{ webRoot }}
tags: 'always' tags:
- always
- name: "File Modes and Ownership" - name: File Modes and Ownership
file: file:
path='{{ webRoot }}' path='{{ webRoot }}'
owner='{{ apacheUser }}' owner='{{ apacheUser }}'
...@@ -46,31 +50,34 @@ ...@@ -46,31 +50,34 @@
mode='g+w' mode='g+w'
recurse=yes recurse=yes
follow=no follow=no
tags: 'deploy' tags:
- deploy
- name: "Clone Git Repository" - name: Clone Git Repository
git: git:
accept_hostkey: yes accept_hostkey: yes
repo: 'git@github.com:matomo-org/matomo.git' repo: git@github.com:matomo-org/matomo.git
dest: '{{ webRoot }}' dest: '{{ webRoot }}'
track_submodules: yes track_submodules: yes
force: yes force: yes
version: '{{ matomo_version }}' version: '{{ matomo_version }}'
become: false become: false
environment: environment:
GIT_LFS_SKIP_SMUDGE: '1' GIT_LFS_SKIP_SMUDGE: 1
tags: 'deploy' tags:
- deploy
- name: "Configuration file" - name: Configuration file
template: template:
src='config.ini.php' src='config.ini.php'
dest='{{ webRoot }}/config/config.ini.php' dest='{{ webRoot }}/config/config.ini.php'
owner='{{ apacheUser }}' owner='{{ apacheUser }}'
group='{{ apacheUser }}' group='{{ apacheUser }}'
mode='664' mode='664'
tags: 'deploy' tags:
- deploy
- name: "Composer" - name: Composer
composer: composer:
command='update' command='update'
working_dir='{{ webRoot }}' working_dir='{{ webRoot }}'
...@@ -78,9 +85,10 @@ ...@@ -78,9 +85,10 @@
optimize_autoloader=yes optimize_autoloader=yes
prefer_dist=yes prefer_dist=yes
ignore_errors: true ignore_errors: true
tags: 'deploy' tags:
- deploy
- name: "Ensure Working Directories" - name: Ensure Working Directories
file: file:
path='{{ item }}' path='{{ item }}'
state='directory' state='directory'
...@@ -88,10 +96,11 @@ ...@@ -88,10 +96,11 @@
group='{{ apacheUser }}' group='{{ apacheUser }}'
mode='775' mode='775'
with_items: with_items:
- '{{ webRoot }}/tmp' - {{ webRoot }}/tmp
tags: 'always' tags:
- always
- name: "File Modes and Ownership" - name: File Modes and Ownership
file: file:
path='{{ webRoot }}' path='{{ webRoot }}'
owner='{{ apacheUser }}' owner='{{ apacheUser }}'
...@@ -99,25 +108,28 @@ ...@@ -99,25 +108,28 @@
mode='a-w' mode='a-w'
recurse=yes recurse=yes
follow=no follow=no
tags: 'deploy' tags:
- deploy
- name: "File Modes for .git Directory" - name: File Modes for .git Directory
file: file:
path='{{ webRoot }}/.git' path='{{ webRoot }}/.git'
mode='og+w' mode='og+w'
recurse=yes recurse=yes
follow=no follow=no
tags: 'deploy' tags:
- deploy
- name: "File Modes for tmp" - name: File Modes for tmp
file: file:
path='{{ webRoot }}/tmp' path='{{ webRoot }}/tmp'
mode='ug+w' mode='ug+w'
recurse=yes recurse=yes
follow=no follow=no
tags: 'deploy' tags:
- deploy
- name: "Ensure Database" - name: Ensure Database
mysql_db: mysql_db:
name='matomo_{{ matomo.id }}' name='matomo_{{ matomo.id }}'
login_user='root' login_user='root'
...@@ -126,8 +138,9 @@ ...@@ -126,8 +138,9 @@
login_port='{{ matomo.db_port|default('3306') }}' login_port='{{ matomo.db_port|default('3306') }}'
state='present' state='present'
- name: "Run Upgrade" - name: Run Upgrade
command: '{{ webRoot }}/console core:update --yes --no-interaction' command: '{{ webRoot }}/console core:update --yes --no-interaction'
become_user: '{{ apacheUser }}' become_user: '{{ apacheUser }}'
ignore_errors: true ignore_errors: true
tags: 'deploy' tags:
- deploy
--- ---
# file: roles/matomo/tasks/main.yml # file: roles/matomo/tasks/main.yml
- name: "matomo Role" - name: matomo Role
set_fact: role_matomo_started=true set_fact:
tags: 'always' role_matomo_started: yes
tags:
- always
- block: - block:
- name: "Install Certs" - name: Install Certs
include_tasks: '../../letsencrypt/tasks/cert.yml' include_tasks: ../../letsencrypt/tasks/cert.yml
with_items: '{{ matomo_settings|default([]) }}' with_items: '{{ matomo_settings|default([]) }}'
loop_control: loop_control:
loop_var: domain loop_var: domain
when: domain.protocol|default("https") == "https" and domain.letsencrypt|default(true) when: domain.protocol|default("https") == "https" and domain.letsencrypt|default(true)
tags: 'ApacheConfig' tags:
- ApacheConfig
when: '"letsencrypt" not in excluded_roles and groups.proxyserver is not defined' when: not excluded_roles or "letsencrypt" not in excluded_roles and groups.proxyserver is not defined
- block: - block:
- name: "Install matomo" - name: Install matomo
include_tasks: install.yml include_tasks: install.yml
with_items: '{{ matomo_settings|default([]) }}' with_items: '{{ matomo_settings|default([]) }}'
loop_control: loop_control:
loop_var: matomo loop_var: matomo
when: limit_site is not defined or limit_site == 'False' or matomo.id is not defined or limit_site == matomo.id when: limit_site is not defined or limit_site == 'False' or matomo.id is not defined or limit_site == matomo.id
tags: tags:
- 'ApacheConfig' - ApacheConfig
- 'deploy' - deploy
when: '"matomo" not in excluded_roles' when: not excluded_roles or "matomo" not in excluded_roles
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment