Compare commits

...

2 commits

Author SHA1 Message Date
six
f0d65afd45 comment on debian-frotend/tasks/nginx.yml 2021-02-20 14:03:56 +01:00
six
db06f882d6 add debian-base and debian-frotend roles 2021-02-20 13:46:16 +01:00
6 changed files with 182 additions and 0 deletions

View file

@ -0,0 +1,4 @@
deb http://deb.debian.org/debian buster main contrib non-free
deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free
deb http://deb.debian.org/debian buster-updates main contrib non-free
deb http://deb.debian.org/debian buster-backports main contrib non-free

View file

@ -0,0 +1,45 @@
- name: debian-base - Copia apt/sources.list completo
copy:
src: sources.list
dest: /etc/apt/sources.list
- name: debian-base - Aggiorna indici apt-get
apt:
update_cache: yes
#- name: Aggiorna distro
# apt:
# upgrade: dist
- name: debian-base - Installa pacchetti sistema base
apt:
name: "{{ item }}"
state: latest
with_items:
- amd64-microcode
- bmon
- bzip2
- ca-certificates
- console-data
- curl
# - etckeeper
- git
- htop
- intel-microcode
- less
- lnav
- openssh-server
- rar
- screen
- sudo
- tree
- unzip
- unar
- unrar
- unattended-upgrades
- vim
- wget
- zip
- zsh

View file

@ -0,0 +1 @@
deb http://nginx.org/packages/debian/ buster nginx

View file

@ -0,0 +1,4 @@
deb http://deb.debian.org/debian buster main contrib non-free
deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free
deb http://deb.debian.org/debian buster-updates main contrib non-free
deb http://deb.debian.org/debian buster-backports main contrib non-free

View file

@ -0,0 +1,71 @@
---
- debug:
msg: "Distro: {{ hostvars[inventory_hostname].ansible_distribution }} {{ hostvars[inventory_hostname].ansible_distribution_version }}"
- name: Copia apt/sources.list (Debian)
when: ansible_distribution == "Debian"
become: true
copy:
src: sources-debian.list
dest: /etc/apt/sources.list
- name: Aggiorna indici apt-get
become: true
apt:
update_cache: yes
- name: Installa pacchetti base dalla distro
apt:
name: [
'amd64-microcode',
'bmon',
'bzip2',
'ca-certificates',
'console-data',
'curl',
'git',
'htop',
'intel-microcode',
'less',
'lnav',
'rar',
'screen',
'sudo',
'tree',
'unzip',
'unar',
'unrar',
'unattended-upgrades',
'vim',
'wget',
'zip',
'zsh',
]
state: latest
update_cache: yes
#TODO
- name: Installa pacchetti webserver
apt:
name: [
'apt-transport-https',
'curl',
'ca-certificates',
'clamav',
'clamav-freshclam',
'gnupg2',
'imagemagick',
'jpegoptim',
'libapache2-mod-rpaf',
'optipng',
'pngquant',
'python3-pip',
]
default_release: ascii-backports
state: latest
default_release: ascii-backports
- include: nginx.yml

View file

@ -0,0 +1,57 @@
---
- name: Copia apt-nginx.list
copy:
src: apt-nginx.list
dest: /etc/apt/sources.list.d/nginx.list
- name: Importa chiave gpg nginx.org
apt_key:
#id: ABF5BD827BD9BF62
#id: 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
url: https://nginx.org/keys/nginx_signing.key
state: present
- name: Installa nginx.org
apt:
name: nginx
state: latest
install_recommends: yes
update_cache: yes
- name: Installa certbot per nginx
apt:
name: python3-certbot-nginx
state: latest
install_recommends: yes
# TODO: importa o crea certificati letsencrypt, forse ridondante con roles/stable/nginx
#- name: Copia file configurazione nginx
# copy:
# src: "{{ item.origin }}"
# dest: "/etc/nginx/{{ item.dest }}"
# owner: root
# group: root
# mode: 0644
# backup: yes
# with_items:
# - { origin: 'nginx/nginx.conf', dest: 'nginx.conf' }
# - { origin: 'nginx/deny.conf', dest: 'deny.conf' }
#- name: Disabilita sito di default Nginx
# file:
# path: /etc/nginx/sites-enabled/default
# state: absent
#- name: Crea directory per il sito
# file:
# path: /var/www/websites/
# state: directory
# mode: 0755
#- name: Abilita Nginx al boot, ma non avviarlo ancora (altrimenti crasha perchè mancano i certificati SSL)
# service:
# name: nginx
# state: stopped
# enabled: yes