Changeset - 5a1431fa7615
[Not reviewed]
0 0 9
Max Wahl (Fantawams) - 3 years ago 2022-06-26 10:43:15
fantawams@c3l.lu
Added default API, Firmware. Added templaten directory files
9 files changed with 218 insertions and 0 deletions:
0 comments (0 inline, 0 general)
ReadMe.md
Show inline comments
 
new file 100644
 
hosts file : Contains all your maschines. Be very carefull, a wrong defined maschine can lead to major proplems.
 
files directory: contains templates for your playbooks.
 
api : for api.freifunk.lu.
 
firmware : for firmware.freifunk.lu.
 
initial : for initial server setup.
 
gatewaay : for fflux gateway setup.
api/ReadMe.md
Show inline comments
 
new file 100644
 
This will install a default api nginx config.
 
Before executing please check your hosts file and use hosts variable.
api/api.freifunk.lu.yml
Show inline comments
 
new file 100644
 
---
 
- hosts: test
 
  become: yes
 
  vars:
 
    server_name: 'api.freifunk.lu '
 
    document_root: /var/www/api.freifunk.lu
 
  tasks:
 
    - name: Update apt cache and install Nginx
 
      apt:
 
        name: nginx
 
        state: latest
 
        update_cache: yes
 

	
 
# Create directory  api.freifunk.lu
 
    - name: Create the directory api.freifunk.lu in /var/www if it does not exist
 
      ansible.builtin.file:
 
        path: /var/www/api.freifunk.lu
 
        state: directory
 
        mode: '0755'
 

	
 
    - name: Apply Nginx template
 
      template:
 
        src: /etc/ansible/playbooks/files/api.conf.j2
 
        dest: /etc/nginx/sites-available/api.freifunk.lu
 
      notify: Restart Nginx
 

	
 
    - name: Enable new site
 
      file:
 
        src: /etc/nginx/sites-available/api.freifunk.lu
 
        dest: /etc/nginx/sites-enabled/api.freifunk.lu
 
        state: link
 
      notify: Restart Nginx
 

	
 
  handlers:
 
    - name: Restart Nginx
 
      service:
 
        name: nginx
 
        state: restarted  
files/api.conf.j2
Show inline comments
 
new file 100644
 
server {
 
  listen [::]:80;
 
  listen 80;
 
	server_name {{ server_name }};
 

	
 
	access_log /var/log/nginx/firmware.freifunk.lu-access.log;
 
        error_log /var/log/nginx/firmware.freifunk.lu-error.log;
 

	
 
	root {{ document_root }};
 
  
 
	index index.html luxembourg-api.json;
 
	
 
	location / {
 
		try_files $uri $uri/ /luxembourg-api.json;
 
	}
 
}
files/firmware.conf.j2
Show inline comments
 
new file 100644
 
server {
 
  listen [::]:80;
 
  listen 80;
 
	server_name {{ server_name }};
 

	
 
	access_log /var/log/nginx/firmware.freifunk.lu-access.log;
 
        error_log /var/log/nginx/firmware.freifunk.lu-error.log;
 

	
 
	root {{ document_root }};
 
  
 
	index index.html;
 
  
 
	location = /favicon.ico {
 
                log_not_found off;
 
                access_log off;
 

	
 
        }
 

	
 
        location = /robots.txt {
 
                allow all;
 
                log_not_found off;
 
                access_log off;
 
        }
 

	
 
        location / {
 
		autoindex on;
 
                try_files $uri $uri/ index.html =404;
 
        }
 
}
files/nginx.conf.j2
Show inline comments
 
new file 100644
 
server {
 
  listen [::]:80;
 
  listen 80;
 
	server_name {{ server_name }};
 

	
 
	access_log /var/log/nginx/firmware.freifunk.lu-access.log;
 
        error_log /var/log/nginx/firmware.freifunk.lu-error.log;
 

	
 
	root {{ document_root }};
 
  
 
	index index.html;
 
  
 
	location = /favicon.ico {
 
                log_not_found off;
 
                access_log off;
 

	
 
        }
 

	
 
        location = /robots.txt {
 
                allow all;
 
                log_not_found off;
 
                access_log off;
 
        }
 

	
 
        location / {
 
		autoindex on;
 
                try_files $uri $uri/ index.html =404;
 
        }
 
}
firmware/ReadMe.md
Show inline comments
 
new file 100644
 
This will install a default firmware nginx config.
 
Before executing please check your hosts file and use hosts variable.
firmware/firmware.freifunk.lu.yml
Show inline comments
 
new file 100644
 
---
 
- hosts: test
 
  become: yes
 
  vars:
 
    server_name: 'firmware.freifunk.lu '
 
    document_root: /var/www/firmware.freifunk.lu
 
  tasks:
 
    - name: Update apt cache and install Nginx
 
      apt:
 
        name: nginx
 
        state: latest
 
        update_cache: yes
 

	
 
# Create directory  firmware.freifunk.lu
 
    - name: Create the directory firmware.freifunk.lu in /var/www if it does not exist
 
      ansible.builtin.file:
 
        path: /var/www/firmware.freifunk.lu
 
        state: directory
 
        mode: '0755'
 

	
 

	
 
    - name: Apply Nginx template
 
      template:
 
        src: /etc/ansible/playbooks/files/firmware.conf.j2
 
        dest: /etc/nginx/sites-available/firmware.freifunk.lu
 
      notify: Restart Nginx
 

	
 
    - name: Enable new site
 
      file:
 
        src: /etc/nginx/sites-available/firmware.freifunk.lu
 
        dest: /etc/nginx/sites-enabled/firmware.freifunk.lu
 
        state: link
 
      notify: Restart Nginx
 

	
 
  handlers:
 
    - name: Restart Nginx
 
      service:
 
        name: nginx
 
        state: restarted  
hosts
Show inline comments
 
new file 100644
 
# This is the default ansible 'hosts' file.
 
#
 
# It should live in /etc/ansible/hosts
 
#
 
#   - Comments begin with the '#' character
 
#   - Blank lines are ignored
 
#   - Groups of hosts are delimited by [header] elements
 
#   - You can enter hostnames or ip addresses
 
#   - A hostname/ip can be a member of multiple groups
 

	
 
# server list is here
 
fflux-test ansible_host=89.58.3.252 new_hostname=fflux-test
 

	
 
# machines which are used for tests
 
[test]
 
fflux-test
 

	
 
# variable for the test group come here
 
[test:vars]
 
#mac1=ca:fe:ca:fe:00:19
 
#ipv4=10.24.128.19
 
#ipv6=fd4e:f2d7:88d2:fffe::19
 
#vars_files: /etc/ansible/host_vars/firmware.freifunk.lu
 

	
 
# all machine variables come here
 
[all:vars]
 
ansible_python_interpreter=/usr/bin/python3
 
ansible_ssh_private_key_file=/home/fflux/.ssh/fflux_fflux
 

	
 
# new machine come here
 
[initial]
 
#fflux-test
 

	
 
# machines which run api.freifunk.lu
 
[API]
 

	
 
# machines which run map.freifunk.lu
 
[MAP]
 

	
 
# machines which run stats.freifunk.lu
 
[STATS]
 

	
 
# machines which run firmware.freifunk.lu
 
[FIRMWARE]
 

	
 
# machines which run freifunk.lu
 
[WORDPRESS]
 

	
 
# machine which are gateways for freifunk.lu
 
[fflux]
 

	
 
[gw1]
 

	
 
[gw2]
 

	
 
[gw3]
 

	
0 comments (0 inline, 0 general)