Private
Public Access
2
0

Main target is now Debian 13 instead of Ubuntu 24.04

This commit is contained in:
2026-03-18 09:53:24 +03:00
parent 5199567bda
commit 63ed305852
14 changed files with 114 additions and 26 deletions

View File

@@ -2,6 +2,25 @@ linux:
vars: vars:
ansible_user: "root" ansible_user: "root"
debian13:
hosts:
bdd1:
nfs1:
waf1:
# waf2:
# waf3:
www1:
www2:
www3:
# www4:
# www5:
vars:
ansible_python_interpreter: "/usr/bin/python3.13"
ubuntu2204lts:
vars:
ansible_python_interpreter: "/usr/bin/python3.10"
ubuntu2404lts: ubuntu2404lts:
vars: vars:
ansible_python_interpreter: "/usr/bin/python3.12" ansible_python_interpreter: "/usr/bin/python3.12"

View File

@@ -24,19 +24,19 @@
tags: tags:
- "local_ca" - "local_ca"
# - name: Proxy server - name: Proxy server
# hosts: proxy hosts: proxy
# gather_facts: false gather_facts: false
# vars_files: vars_files:
# - "vars/common.yml" - "vars/common.yml"
# - "vars/secrets.yml" - "vars/secrets.yml"
# vars: vars:
# squid_authorized_networks: squid_authorized_networks:
# - "{{ ansible_default_ipv4.network }}/24" - "{{ ansible_default_ipv4.network }}/24"
# roles: roles:
# - "squid" - "squid"
# tags: tags:
# - "proxy" - "proxy"
- name: Common - name: Common
hosts: all hosts: all
@@ -46,6 +46,8 @@
- "vars/secrets.yml" - "vars/secrets.yml"
vars: vars:
# common_proxy_server: "{{ hostvars['proxy1'].ansible_default_ipv4.address }}:3128" # common_proxy_server: "{{ hostvars['proxy1'].ansible_default_ipv4.address }}:3128"
common_search_domains:
- "multipass"
common_default_packages: common_default_packages:
- "net-tools" - "net-tools"
- "htop" - "htop"
@@ -183,11 +185,11 @@
owner: 1001 owner: 1001
group: 33 group: 33
clients: clients:
- address: "www1" - address: "www1.multipass"
options: "rw,no_root_squash" options: "rw,no_root_squash"
- address: "www2" - address: "www2.multipass"
options: "rw,no_root_squash" options: "rw,no_root_squash"
- address: "www3" - address: "www3.multipass"
options: "rw,no_root_squash" options: "rw,no_root_squash"
roles: roles:
- "nfs_server" - "nfs_server"
@@ -203,7 +205,7 @@
vars: vars:
nfs_client_mounts: nfs_client_mounts:
- mount_point: "/var/www/wordpress" - mount_point: "/var/www/wordpress"
server: "nfs1:/srv/wordpress" server: "nfs1.multipass:/srv/wordpress"
owner: 1001 owner: 1001
group: 33 group: 33
wordpress_create_master: "www1" wordpress_create_master: "www1"
@@ -215,7 +217,7 @@
wordpress_admin_email: "seb@itik.fr" wordpress_admin_email: "seb@itik.fr"
wordpress_themes: ["twentytwentyfive"] wordpress_themes: ["twentytwentyfive"]
wordpress_active_theme: "twentytwentyfive" wordpress_active_theme: "twentytwentyfive"
wordpress_db_host: "bdd1" wordpress_db_host: "bdd1.multipass"
wordpress_db_pass: "{{ secrets.wordpress.mysql_password }}" wordpress_db_pass: "{{ secrets.wordpress.mysql_password }}"
roles: roles:
- "nfs_client" - "nfs_client"

View File

@@ -7,15 +7,21 @@ vms = {
}, },
waf2 = { waf2 = {
cpus = 4 cpus = 4
image = "22.04"
}, },
waf3 = { waf3 = {
cpus = 4 cpus = 4
image = "24.04"
}, },
bdd1 = {}, bdd1 = {},
nfs1 = {}, nfs1 = {},
www1 = {}, www1 = {},
www2 = {}, www2 = {},
www3 = {}, www3 = {},
www4 = {}, www4 = {
www5 = {}, image = "22.04"
},
www5 = {
image = "24.04"
},
} }

View File

@@ -4,6 +4,6 @@ variable "vms" {
cpus = optional(number, 2), cpus = optional(number, 2),
memory = optional(string, "3g"), memory = optional(string, "3g"),
disk = optional(string, "12g"), disk = optional(string, "12g"),
image = optional(string, "24.04"), image = optional(string, "https://cloud.debian.org/images/cloud/trixie/latest/debian-13-generic-amd64.qcow2"),
})) }))
} }

View File

@@ -1,2 +1,3 @@
common_search_strings: []
common_default_packages: [] common_default_packages: []
common_proxy_server: null common_proxy_server: null

View File

@@ -0,0 +1,4 @@
- name: Restart systemd-resolved
ansible.builtin.service:
name: "systemd-resolved"
state: "restarted"

View File

@@ -1,7 +1,11 @@
- name: Setup hosts file
ansible.builtin.include_tasks: "setup_hosts.yml"
- name: Setup resolved
ansible.builtin.include_tasks: "setup_resolved.yml"
- name: Setup proxy client - name: Setup proxy client
when: "common_proxy_server != None"
ansible.builtin.include_tasks: "setup_proxy_client.yml" ansible.builtin.include_tasks: "setup_proxy_client.yml"
- name: Setup packages - name: Setup packages
when: "common_default_packages | length > 0"
ansible.builtin.include_tasks: "setup_packages.yml" ansible.builtin.include_tasks: "setup_packages.yml"

View File

@@ -0,0 +1,25 @@
- name: Check if /etc/cloud/cloud.cfg exists
ansible.builtin.stat:
path: "/etc/cloud/cloud.cfg"
register: common_out_cloud_cfg
- name: Disable /etc/hosts management by cloud-init
when: "common_out_cloud_cfg.stat.exists"
block:
- name: Disable /etc/hosts management by cloud-init (manage_etc_hosts)
ansible.builtin.lineinfile:
path: "/etc/cloud/cloud.cfg"
search_string: 'manage_etc_hosts:'
line: "manage_etc_hosts: false"
insertafter: "preserve_hostname:"
- name: Disable /etc/hosts management by cloud-init (update_etc_hosts)
ansible.builtin.replace:
path: "/etc/cloud/cloud.cfg"
regexp: '^([^#]*update_etc_hosts.*)$'
replace: '# \\1'
- name: Configure /etc/hosts file
ansible.builtin.template:
src: "templates/hosts"
dest: "/etc/hosts"
mode: "0644"

View File

@@ -4,6 +4,7 @@
upgrade: "safe" upgrade: "safe"
- name: Install default packages - name: Install default packages
when: "common_default_packages | length > 0"
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ common_default_packages }}" name: "{{ common_default_packages }}"
autoclean: true autoclean: true

View File

@@ -1,4 +1,5 @@
- name: Create 00proxy.conf file - name: Create 00proxy.conf file
when: "common_proxy_server != None"
ansible.builtin.template: ansible.builtin.template:
src: "templates/apt_proxy.conf" src: "templates/apt_proxy.conf"
dest: "/etc/apt/apt.conf.d/00proxy.conf" dest: "/etc/apt/apt.conf.d/00proxy.conf"
@@ -7,6 +8,7 @@
group: "root" group: "root"
- name: Add http_proxy and https_proxy variable to file /etc/environment - name: Add http_proxy and https_proxy variable to file /etc/environment
when: "common_proxy_server != None"
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: "/etc/environment" path: "/etc/environment"
regexp: '^{{ item.key }}=' regexp: '^{{ item.key }}='

View File

@@ -0,0 +1,8 @@
- name: Add multipass in search domains
when: "common_search_domains | length > 0"
ansible.builtin.lineinfile:
path: "/etc/systemd/resolved.conf"
search_string: 'Domains='
line: "Domains={{ common_search_domains | join(' ') }}"
notify:
- "Restart systemd-resolved"

View File

@@ -0,0 +1,9 @@
127.0.0.1 localhost
{{ ansible_default_ipv4.address }} {{ ansible_fqdn }} {{ ansible_hostname }}
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

View File

@@ -1,14 +1,14 @@
- name: Installation de MySQL - name: Installation de MySQL
ansible.builtin.apt: ansible.builtin.apt:
name: name:
- "mysql-server" - "{{ mysql_distros[ansible_distribution].mysql_package }}"
- "python3-pymysql" - "python3-pymysql"
notify: notify:
- "Restart MySQL" - "Restart MySQL"
- name: Set MySQL bind_address parameter - name: Set MySQL bind_address parameter
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: "/etc/mysql/mysql.conf.d/mysqld.cnf" path: "{{ mysql_distros[ansible_distribution].mysql_config_file }}"
regexp: "^bind-address\\s+=" regexp: "^bind-address\\s+="
line: "bind-address = *" line: "bind-address = *"
notify: notify:

View File

@@ -0,0 +1,7 @@
mysql_distros:
Debian:
mysql_package: "default-mysql-server"
mysql_config_file: "/etc/mysql/mariadb.conf.d/50-server.cnf"
Ubuntu:
mysql_package: "mysql-server"
mysql_config_file: "/etc/mysql/mysql.conf.d/mysqld.cnf"