Last active
July 12, 2019 13:04
-
-
Save E-VANCE/6f4187e9373046583f7c443161723315 to your computer and use it in GitHub Desktop.
Revisions
-
E-VANCE revised this gist
Sep 3, 2018 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,12 +29,14 @@ addons_dir: "{{ www_root }}/{{ item.key }}/addons" matomo_db_name: "matomo_{{ env }}" # roles/matomo/tasks/main.yml - name: Create addons folder of sites file: path: "{{ addons_dir }}" owner: "{{ web_user }}" group: "{{ web_group }}" mode: 0755 state: directory with_dict: "{{ wordpress_sites }}" - name: Install Matomo composer: -
E-VANCE revised this gist
Sep 2, 2018 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # group_vars/{staging & production}/wordpress_sites.yml [...] wordpress_sites: example.com: site_hosts: [...] @@ -10,7 +10,7 @@ wordpress_sites: host: localhost # group_vars/{staging & production}/vault.yml [...] vault_wordpress_sites: example.com: env: @@ -20,7 +20,7 @@ vault_wordpress_sites: password: XXXXXX # server.yml [...] - { role: matomo, tags: [matomo] } # roles/matomo/defaults/main.yml @@ -87,9 +87,9 @@ matomo_db_name: "matomo_{{ env }}" 2) Point your browser to {{ wordpress_env_defaults.wp_home }}/analytics 3) Proceed with the form using following credentials: Host: {{ site_env.db_user_host }} Database User: {{ item.value.matomo.db.user }} Database Password: {{ item.value.matomo.db.password }} Database: {{ matomo_db_name }} Table Prefix: none Set up your admin user. 4) Log in to Matomo. @@ -98,7 +98,9 @@ matomo_db_name: "matomo_{{ env }}" tags: matomo # roles/deploy/defaults/main.yml [...] addons_dir: "{{ project_root }}/addons" [...] deploy_share_after: - "{{ playbook_dir }}/deploy-hooks/share-after.yml" -
E-VANCE revised this gist
Sep 2, 2018 . No changes.There are no files selected for viewing
-
E-VANCE revised this gist
Sep 2, 2018 . 1 changed file with 22 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,23 @@ # group_vars/{staging & production}/wordpress_sites.yml ... wordpress_sites: example.com: site_hosts: [...] [...] matomo: db: user: matomo host: localhost # group_vars/{staging & production}/vault.yml ... vault_wordpress_sites: example.com: env: [...] matomo: db: password: XXXXXX # server.yml ... @@ -21,6 +29,13 @@ addons_dir: "{{ www_root }}/{{ item.key }}/addons" matomo_db_name: "matomo_{{ env }}" # roles/matomo/tasks/main.yml - name: Create addons folder file: path: "{{ addons_dir }}" state: directory with_dict: "{{ wordpress_sites }}" tags: matomo - name: Install Matomo composer: command: require -
E-VANCE revised this gist
Sep 2, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -87,7 +87,7 @@ matomo_db_name: "matomo_{{ env }}" deploy_share_after: - "{{ playbook_dir }}/deploy-hooks/share-after.yml" # deploy-hooks/share-after.yml - name: Create symlink to Matomo file: path: "{{ deploy_helper.new_release_path }}/web/analytics" -
E-VANCE revised this gist
Sep 2, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -87,7 +87,7 @@ matomo_db_name: "matomo_{{ env }}" deploy_share_after: - "{{ playbook_dir }}/deploy-hooks/share-after.yml" # roles/deploy/hooks/share-after.yml - name: Create symlink to Matomo file: path: "{{ deploy_helper.new_release_path }}/web/analytics" -
E-VANCE revised this gist
Sep 2, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -87,7 +87,7 @@ matomo_db_name: "matomo_{{ env }}" deploy_share_after: - "{{ playbook_dir }}/deploy-hooks/share-after.yml" # deploy/hooks/share-after.yml - name: Create symlink to Matomo file: path: "{{ deploy_helper.new_release_path }}/web/analytics" -
E-VANCE revised this gist
Sep 2, 2018 . No changes.There are no files selected for viewing
-
E-VANCE created this gist
Sep 2, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,96 @@ # group_vars/{staging & production}/wordpress_sites.yml ... matomo: db: user: matomo host: localhost # group_vars/{staging & production}/vault.yml ... matomo: db: password: # server.yml ... - { role: matomo, tags: [matomo] } # roles/matomo/defaults/main.yml combined_wordpress_sites: "{{ wordpress_sites|combine(vault_wordpress_sites, recursive=True) }}" addons_dir: "{{ www_root }}/{{ item.key }}/addons" matomo_db_name: "matomo_{{ env }}" # roles/matomo/tasks/main.yml - name: Install Matomo composer: command: require arguments: piwik/piwik working_dir: "{{ addons_dir }}" with_dict: "{{ wordpress_sites }}" tags: matomo - name: Create databases for Matomo mysql_db: name: "{{ matomo_db_name }}" state: present login_host: "{{ site_env.db_host }}" login_user: "{{ mysql_root_user }}" login_password: "{{ mysql_root_password }}" with_dict: "{{ wordpress_sites }}" tags: matomo - name: Create/assign database user to db and grant permissions mysql_user: name: "{{ item.value.matomo.db.user }}" password: "{{ item.value.matomo.db.password }}" host: "{{ site_env.db_user_host }}" append_privs: yes priv: "{{ matomo_db_name }}.*:ALL" state: present login_host: "{{ site_env.db_host }}" login_user: "{{ mysql_root_user }}" login_password: "{{ mysql_root_password }}" with_dict: "{{ combined_wordpress_sites }}" tags: matomo - name: Change addons owner to web_user file: path: "{{ addons_dir }}" owner: "{{ web_user }}" group: "{{ web_group }}" state: directory recurse: yes with_dict: "{{ wordpress_sites }}" tags: matomo - name: Explain next steps debug: msg: | If necessary, set up Matomo as follows. 1) Deploy 2) Point your browser to {{ wordpress_env_defaults.wp_home }}/analytics 3) Proceed with the form using following credentials: Host: {{ site_env.db_user_host }} Database: {{ matomo_db_name }} Database User: {{ item.value.matomo.db.user }} Database Password: {{ item.value.matomo.db.password }} Table Prefix: none Set up your admin user. 4) Log in to Matomo. 5) Under Administration/System/Geolocation, download and activate the GeoIP 2 database. with_dict: "{{ combined_wordpress_sites }}" tags: matomo # roles/deploy/defaults/main.yml ... deploy_share_after: - "{{ playbook_dir }}/deploy-hooks/share-after.yml" # deploy-hooks/share-after.yml - name: Create symlink to Matomo file: path: "{{ deploy_helper.new_release_path }}/web/analytics" src: "{{ addons_dir }}/vendor/piwik/piwik" state: link with_items: "{{ wordpress_sites }}"