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_user: dmarcsrg
dmarcsrg_home: /opt/dmarc-srg dmarcsrg_home: /opt/dmarc-srg
overrides_path: "{{ dmarcsrg_home }}/local.d" 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: dmarcsrg
dmarcsrg_database_password: "{{ lookup('password', '/tmp/dmarcsrg_db_pwd length=42 chars=ascii_letters,digits') }}" 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" - name: "Install | Clone repository"
ansible.builtin.shell: ansible.builtin.git:
cmd: curl -sL "{{ dmarcsrg_github_api_url }}" | jq -r ".tag_name" repo: "{{ dmarcsrg_githuburl }}"
changed_when: false dest: "{{ dmarcsrg_home }}"
register: latest_version version: "{{ dmarcsrg_version }}"
force: true
- 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 | Copy configuration file" - name: "Install | Copy configuration file"
ansible.builtin.template: ansible.builtin.template:
src: conf.php.j2 src: conf.php.j2
dest: "{{ overrides_path }}/conf.php" dest: "{{ dmarcsrg_home }}/config/conf.php"
mode: "0640" mode: "0640"
owner: "{{ dmarcsrg_user }}" owner: "{{ dmarcsrg_user }}"
group: "{{ 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" - name: "Install | Initiate database"
ansible.builtin.command: ansible.builtin.command:
cmd: php utils/database_admin.php init cmd: php utils/database_admin.php init
chdir: "{{ dmarcsrg_home }}/current" chdir: "{{ dmarcsrg_home }}"
become: true become: true
become_user: "{{ dmarcsrg_user }}" become_user: "{{ dmarcsrg_user }}"

View file

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