Use Git master version

The latest release is outdated
This commit is contained in:
phil 2023-08-16 21:15:16 +02:00
parent 07580cd132
commit 1f77350d70
3 changed files with 13 additions and 46 deletions

View file

@ -2,7 +2,8 @@
dmarcsrg_user: dmarcsrg
dmarcsrg_home: /opt/dmarc-srg
overrides_path: "{{ dmarcsrg_home }}/local.d"
dmarcsrg_github_api_url: https://api.github.com/repos/liuch/dmarc-srg/releases/latest
dmarcsrg_github_url: https://github.com/liuch/dmarc-srg
dmarcsrg_version: master
dmarcsrg_database: dmarcsrg
dmarcsrg_database_password: "{{ lookup('password', '/tmp/dmarcsrg_db_pwd length=42 chars=ascii_letters,digits') }}"

View file

@ -1,56 +1,22 @@
---
- name: "Install | Check for latest version"
ansible.builtin.shell:
cmd: curl -sL "{{ dmarcsrg_github_api_url }}" | jq -r ".tag_name"
changed_when: false
register: latest_version
- name: "Install | Get download URL"
ansible.builtin.shell:
cmd: curl -sL "{{ dmarcsrg_github_api_url }}" | jq -r ".tarball_url"
changed_when: false
register: download_url
- name: "Install | Create directories"
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: "0755"
loop:
- "{{ dmarcsrg_home }}"
- "{{ dmarcsrg_home }}/{{ latest_version.stdout }}"
- "{{ overrides_path }}"
- name: "Install | Download install files"
ansible.builtin.unarchive:
src: "{{ download_url.stdout }}"
dest: "{{ dmarcsrg_home }}/{{ latest_version.stdout }}"
remote_src: true
extra_opts:
- "--strip-components=1"
- name: "Install | Clone repository"
ansible.builtin.git:
repo: "{{ dmarcsrg_githuburl }}"
dest: "{{ dmarcsrg_home }}"
version: "{{ dmarcsrg_version }}"
force: true
- name: "Install | Copy configuration file"
ansible.builtin.template:
src: conf.php.j2
dest: "{{ overrides_path }}/conf.php"
dest: "{{ dmarcsrg_home }}/config/conf.php"
mode: "0640"
owner: "{{ dmarcsrg_user }}"
group: "{{ dmarcsrg_user }}"
- name: "Install | Link data"
ansible.builtin.file:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
state: link
loop:
- src: "{{ dmarcsrg_home }}/{{ latest_version.stdout }}"
dest: "{{ dmarcsrg_home }}/current"
- src: "{{ overrides_path }}/conf.php"
dest: "{{ dmarcsrg_home }}/{{ latest_version.stdout }}/config/conf.php"
- name: "Install | Initiate database"
ansible.builtin.command:
cmd: php utils/database_admin.php init
chdir: "{{ dmarcsrg_home }}/current"
chdir: "{{ dmarcsrg_home }}"
become: true
become_user: "{{ dmarcsrg_user }}"

View file

@ -1,6 +1,6 @@
<VirtualHost *:80>
ServerName {{ dmarcsrg_domain }}
DocumentRoot {{ dmarcsrg_home }}/current
DocumentRoot {{ dmarcsrg_home }}
ErrorLog /var/log/apache2/{{ dmarcsrg_domain }}.error
<FilesMatch ".+\.ph(ar|p|tml)$">
@ -13,14 +13,14 @@
Require all denied
</FilesMatch>
<Directory {{ dmarcsrg_home }}/current>
<Directory {{ dmarcsrg_home }}>
DirectoryIndex index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<DirectoryMatch "^/{{ dmarcsrg_home }}/current/(classes|config|tests|utils)/*">
<DirectoryMatch "^/{{ dmarcsrg_home }}/(classes|config|tests|utils)/*">
Options None
Require all denied
</DirectoryMatch>