forked from tleguern/ansible-role-selfoss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
202 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This guide is optimized for Vagrant 1.7 and above. | ||
# Although versions 1.6.x should behave very similarly, it is recommended | ||
# to upgrade instead of disabling the requirement below. | ||
Vagrant.require_version ">= 1.7.0" | ||
|
||
Vagrant.configure(2) do |config| | ||
|
||
config.vm.box = "debian/bullseye64" | ||
|
||
config.vm.define "debiantest" do |m| | ||
m.vm.hostname = "debiantest" | ||
m.vm.network :private_network, ip: "192.168.123.2", libvirt__dhcp_enabled: false | ||
m.vm.synced_folder ".", "/vagrant", disabled: true | ||
end | ||
# Disable the new default behavior introduced in Vagrant 1.7, to | ||
# ensure that all Vagrant machines will use the same SSH key pair. | ||
# See https://github.com/mitchellh/vagrant/issues/5005 | ||
config.ssh.insert_key = false | ||
|
||
config.vm.provider :libvirt do |lv| | ||
lv.cpus = 2 | ||
lv.memory = 1024 | ||
end | ||
|
||
config.vm.provision "ansible" do |ansible| | ||
ansible.become = true | ||
ansible.verbose = "v" | ||
ansible.playbook = "playbook.yml" | ||
ansible.inventory_path = "inventory" | ||
end | ||
end |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[defaults] | ||
roles_path = ../ |
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- name: restart nginx | ||
systemd: | ||
name: nginx.service | ||
state: restarted |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
debiantest |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- hosts: debiantest | ||
gather_facts: yes | ||
vars_files: | ||
- ./test/vars.yml | ||
|
||
roles: | ||
- ansible-selfoss |
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
- name: Install selfoss dependencies | ||
apt: | ||
name: | ||
- php-fpm | ||
- php-sqlite3 | ||
- php-gd | ||
- php-xml | ||
- unzip | ||
update_cache: yes | ||
state: present | ||
|
||
- name: Add selfoss runner users | ||
user: | ||
name: "{{ selfoss_www_user }}" | ||
group: www-data | ||
state: present | ||
system: True | ||
shell: /usr/sbin/nologin | ||
home: "{{ selfoss_install_dir }}" | ||
create_home: True | ||
when: selfoss_create_user | ||
|
||
- name: Download selfoss from web | ||
unarchive: | ||
src: "{{ ___selfoss_download_url }}" | ||
dest: /tmp | ||
remote_src: yes | ||
|
||
- name: Replace current selfoss, if any | ||
copy: | ||
src: /tmp/selfoss | ||
dest: "{{ selfoss_default_install_dir | dirname }}" | ||
remote_src: yes | ||
|
||
- name: Create configuration from default | ||
copy: | ||
src: "{{ selfoss_default_install_dir }}/defaults.ini" | ||
dest: "{{ selfoss_default_install_dir }}/config.ini" | ||
remote_src: yes | ||
|
||
- name: Ensure php-fpm is running | ||
systemd: | ||
name: "php{{ selfoss_php_version }}-fpm.service" | ||
enabled: yes | ||
state: started | ||
|
||
- name: Ensure allow_url_fopen is enabled in php.ini | ||
ini_file: | ||
path: /etc/php/{{ selfoss_php_version }}/fpm/php.ini | ||
section: PHP | ||
option: allow_url_fopen | ||
value: 'On' | ||
|
||
- include: "webserver.yml" | ||
|
||
- name: Force all notified handlers to run at this point, not waiting for normal sync points | ||
meta: flush_handlers |
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- name: Install selfoss dependencies | ||
apt: | ||
name: nginx | ||
state: present | ||
|
||
- name: Ensure the configuration file is present | ||
template: | ||
src: selfoss.conf.j2 | ||
dest: /etc/nginx/sites-available/selfoss.conf | ||
mode: 0644 | ||
owner: root | ||
group: root | ||
notify: restart nginx | ||
|
||
- name: Ensure nginx configuration is enabled | ||
file: | ||
src: /etc/nginx/sites-available/selfoss.conf | ||
dest: /etc/nginx/sites-enabled/selfoss.conf | ||
owner: root | ||
group: root | ||
state: link | ||
notify: restart nginx | ||
|
||
- name: Ensure default nginx configuration is absent | ||
file: | ||
dest: /etc/nginx/sites-enabled/default | ||
state: absent | ||
notify: restart nginx | ||
|
||
- name: Enable nginx service | ||
systemd: | ||
name: nginx.service | ||
enabled: yes | ||
state: started |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
server { | ||
listen {{ selfoss_port }} default_server; | ||
root {{ selfoss_install_dir }}; | ||
access_log /var/log/nginx/selfoss.access.log; | ||
error_log /var/log/nginx/selfoss.error.log; | ||
|
||
location ~* \ (gif|jpg|png) { | ||
expires 30d; | ||
} | ||
|
||
location ~ ^/(favicons|thumbnails)/.*$ { | ||
try_files $uri /data/$uri; | ||
} | ||
|
||
location ~* ^/(data\/logs|data\/sqlite|config\.ini|\.ht) { | ||
deny all; | ||
} | ||
|
||
location / { | ||
index index.php; | ||
try_files $uri /public/$uri /index.php$is_args$args; | ||
} | ||
|
||
location ~ \.php$ { | ||
fastcgi_pass unix:/var/run/php/php{{ selfoss_php_version }}-fpm.sock; | ||
fastcgi_index index.php; | ||
include fastcgi.conf; | ||
} | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
selfoss_create_user: False | ||
selfoss_www_user: www-data | ||
selfoss_www_group: www-data | ||
selfoss_port: "8080" | ||
selfoss_url: http://debiantest:8080 | ||
selfoss_username: leo | ||
selfoss_password: password | ||
selfoss_include_nginx: True | ||
selfoss_password_salt: $2b$10$06dc9qpT/wPf/NxnMEngVO | ||
selfoss_password_hash: $2b$10$06dc9qpT/wPf/NxnMEngVO8nAgAq4TS4Erts4fSjT.S/SxECQ8deS |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
selfoss_php_version: "7.4" | ||
___selfoss_download_url: https://bintray.com/fossar/selfoss/download_file?file_path=selfoss-2.19-9af53e9.zip | ||
___selfoss_php_path: /usr/bin/php |