Use FQCN
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2777|524|2253|2462|:+1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/223//ansiblelint">Evolix » ansible-roles » unstable #223</a>
gitea/ansible-roles/pipeline/head This commit looks good
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2777|524|2253|2462|:+1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/223//ansiblelint">Evolix » ansible-roles » unstable #223</a>
gitea/ansible-roles/pipeline/head This commit looks good
Fully Qualified Collection Name
This commit is contained in:
parent
7a73df6bd7
commit
ee21973371
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: restart amavis
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: amavis
|
||||
state: restarted
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: install Amavis
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- postgrey
|
||||
- amavisd-new
|
||||
|
@ -9,7 +9,7 @@
|
|||
- amavis
|
||||
|
||||
- name: configure Amavis
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: amavis.conf.j2
|
||||
dest: /etc/amavis/conf.d/49-evolinux-defaults
|
||||
mode: "0644"
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
aws_region: ca-central-1
|
||||
|
||||
tasks:
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/amazon-ec2
|
||||
tasks_from: setup.yml
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/amazon-ec2
|
||||
tasks_from: create-instance.yml
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
|||
- mysql
|
||||
|
||||
post_tasks:
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/etc-git
|
||||
tasks_from: commit.yml
|
||||
vars:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Launch new instance(s)
|
||||
ec2:
|
||||
amazon.aws.ec2:
|
||||
state: present
|
||||
aws_access_key: "{{ aws_access_key }}"
|
||||
aws_secret_key: "{{ aws_secret_key }}"
|
||||
|
@ -16,19 +16,19 @@
|
|||
register: ec2
|
||||
|
||||
- name: Add newly created instance(s) to inventory
|
||||
add_host:
|
||||
ansible.builtin.add_host:
|
||||
hostname: "{{ item.public_dns_name }}"
|
||||
groupname: launched-instances
|
||||
ansible_user: admin
|
||||
ansible_ssh_common_args: "-o StrictHostKeyChecking=no"
|
||||
loop: "{{ ec2.instances }}"
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "Your newly created instance is reachable at: {{ item.public_dns_name }}"
|
||||
loop: "{{ ec2.instances }}"
|
||||
|
||||
- name: Wait for SSH to come up on all instances (give up after 2m)
|
||||
wait_for:
|
||||
ansible.builtin.wait_for:
|
||||
state: started
|
||||
host: "{{ item.public_dns_name }}"
|
||||
port: 22
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: Remove admin user
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: admin
|
||||
state: absent
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Create default security group
|
||||
ec2_group:
|
||||
amazon.aws.ec2_group:
|
||||
name: "{{ ec2_security_group.name }}"
|
||||
state: present
|
||||
aws_access_key: "{{ aws_access_key }}"
|
||||
|
@ -12,7 +12,7 @@
|
|||
rules_egress: "{{ ec2_security_group.rules_egress }}"
|
||||
|
||||
- name: Create key pair
|
||||
ec2_key:
|
||||
amazon.aws.ec2_key:
|
||||
name: "{{ ec2_keyname }}"
|
||||
state: present
|
||||
aws_access_key: "{{ aws_access_key }}"
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
- name: restart apache
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: apache2
|
||||
state: restarted
|
||||
|
||||
- name: reload apache
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: apache2
|
||||
state: reloaded
|
||||
|
||||
- name: restart munin-node
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: munin-node
|
||||
state: restarted
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Init ipaddr_whitelist.conf file
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: ipaddr_whitelist.conf
|
||||
dest: /etc/apache2/ipaddr_whitelist.conf
|
||||
owner: root
|
||||
|
@ -12,10 +12,10 @@
|
|||
- apache
|
||||
|
||||
- name: Load IP whitelist task
|
||||
include: ip_whitelist.yml
|
||||
ansible.builtin.import_tasks: ip_whitelist.yml
|
||||
|
||||
- name: include private IP whitelist for server-status
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/apache2/mods-available/status.conf
|
||||
line: " include /etc/apache2/ipaddr_whitelist.conf"
|
||||
insertafter: 'SetHandler server-status'
|
||||
|
@ -24,7 +24,7 @@
|
|||
- apache
|
||||
|
||||
- name: Copy private_htpasswd
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: private_htpasswd
|
||||
dest: /etc/apache2/private_htpasswd
|
||||
owner: root
|
||||
|
@ -36,7 +36,7 @@
|
|||
- apache
|
||||
|
||||
- name: add user:pwd to private htpasswd
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/apache2/private_htpasswd
|
||||
line: "{{ item }}"
|
||||
state: present
|
||||
|
@ -46,7 +46,7 @@
|
|||
- apache
|
||||
|
||||
- name: remove user:pwd from private htpasswd
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/apache2/private_htpasswd
|
||||
line: "{{ item }}"
|
||||
state: absent
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: add IP addresses to private IP whitelist
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/apache2/ipaddr_whitelist.conf
|
||||
line: "Require ip {{ item }}"
|
||||
state: present
|
||||
|
@ -12,7 +12,7 @@
|
|||
- ips
|
||||
|
||||
- name: remove IP addresses from private IP whitelist
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/apache2/ipaddr_whitelist.conf
|
||||
line: "Require ip {{ item }}"
|
||||
state: absent
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
|
||||
- name: log2mail is installed
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: log2mail
|
||||
state: present
|
||||
tags:
|
||||
- apache
|
||||
|
||||
- name: Add log2mail config for Apache segfaults
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: log2mail-apache.j2
|
||||
dest: "/etc/log2mail/config/apache"
|
||||
owner: log2mail
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: packages are installed (Debian 9 or later)
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- apache2
|
||||
- libapache2-mod-evasive
|
||||
|
@ -14,7 +14,7 @@
|
|||
when: ansible_distribution_major_version is version('9', '>=')
|
||||
|
||||
- name: itk package is installed if required (Debian 9 or later)
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- libapache2-mpm-itk
|
||||
state: present
|
||||
|
@ -26,7 +26,7 @@
|
|||
- apache_mpm == "itk"
|
||||
|
||||
- name: packages are installed (jessie)
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- apache2-mpm-itk
|
||||
- libapache2-mod-evasive
|
||||
|
@ -39,7 +39,7 @@
|
|||
when: ansible_distribution_release == "jessie"
|
||||
|
||||
- name: basic modules are enabled
|
||||
apache2_module:
|
||||
community.general.apache2_module:
|
||||
name: '{{ item }}'
|
||||
state: present
|
||||
loop:
|
||||
|
@ -55,7 +55,7 @@
|
|||
- apache
|
||||
|
||||
- name: basic modules are enabled
|
||||
apache2_module:
|
||||
community.general.apache2_module:
|
||||
name: '{{ item }}'
|
||||
state: present
|
||||
loop:
|
||||
|
@ -67,7 +67,7 @@
|
|||
|
||||
|
||||
- name: Copy Apache defaults config file
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: evolinux-defaults.conf
|
||||
dest: "/etc/apache2/conf-available/z-evolinux-defaults.conf"
|
||||
owner: root
|
||||
|
@ -79,7 +79,7 @@
|
|||
- apache
|
||||
|
||||
- name: Copy Apache custom config file
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: evolinux-custom.conf
|
||||
dest: "/etc/apache2/conf-available/zzz-evolinux-custom.conf"
|
||||
owner: root
|
||||
|
@ -91,7 +91,7 @@
|
|||
- apache
|
||||
|
||||
- name: disable status.conf
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: /etc/apache2/mods-enabled/status.conf
|
||||
state: absent
|
||||
notify: reload apache
|
||||
|
@ -99,7 +99,8 @@
|
|||
- apache
|
||||
|
||||
- name: Ensure Apache config files are enabled
|
||||
command: "a2enconf {{ item }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "a2enconf {{ item }}"
|
||||
register: command_result
|
||||
changed_when: "'Enabling' in command_result.stderr"
|
||||
loop:
|
||||
|
@ -109,12 +110,12 @@
|
|||
tags:
|
||||
- apache
|
||||
|
||||
- include: auth.yml
|
||||
- ansible.builtin.include: auth.yml
|
||||
tags:
|
||||
- apache
|
||||
|
||||
- name: default vhost is installed
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: evolinux-default.conf.j2
|
||||
dest: /etc/apache2/sites-available/000-evolinux-default.conf
|
||||
mode: "0640"
|
||||
|
@ -124,7 +125,7 @@
|
|||
- apache
|
||||
|
||||
- name: default vhost is enabled
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
src: /etc/apache2/sites-available/000-evolinux-default.conf
|
||||
dest: /etc/apache2/sites-enabled/000-default.conf
|
||||
state: link
|
||||
|
@ -134,12 +135,13 @@
|
|||
tags:
|
||||
- apache
|
||||
|
||||
- include: server_status.yml
|
||||
- ansible.builtin.include: server_status.yml
|
||||
tags:
|
||||
- apache
|
||||
|
||||
- name: is umask already present?
|
||||
command: "grep -E '^umask ' /etc/apache2/envvars"
|
||||
ansible.builtin.command:
|
||||
cmd: "grep -E '^umask ' /etc/apache2/envvars"
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
register: envvar_grep_umask
|
||||
|
@ -148,7 +150,7 @@
|
|||
- apache
|
||||
|
||||
- name: Add a mark in envvars for umask
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
dest: /etc/apache2/envvars
|
||||
marker: "## {mark} ANSIBLE MANAGED BLOCK"
|
||||
block: |
|
||||
|
@ -159,13 +161,13 @@
|
|||
tags:
|
||||
- apache
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
tags:
|
||||
- apache
|
||||
|
||||
- name: /usr/share/scripts exists
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: /usr/share/scripts
|
||||
mode: "0700"
|
||||
owner: root
|
||||
|
@ -175,7 +177,7 @@
|
|||
- apache
|
||||
|
||||
- name: "Install save_apache_status.sh"
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: save_apache_status.sh
|
||||
dest: /usr/share/scripts/save_apache_status.sh
|
||||
mode: "0755"
|
||||
|
@ -184,7 +186,7 @@
|
|||
- apache
|
||||
|
||||
- name: "logrotate: {{ apache_logrotate_frequency }}"
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/logrotate.d/apache2
|
||||
regexp: "(daily|weekly|monthly)"
|
||||
replace: "{{ apache_logrotate_frequency }}"
|
||||
|
@ -192,19 +194,19 @@
|
|||
- apache
|
||||
|
||||
- name: "logrotate: rotate {{ apache_logrotate_rotate }}"
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/logrotate.d/apache2
|
||||
regexp: '^(\s+rotate) \d+$'
|
||||
replace: '\1 {{ apache_logrotate_rotate }}'
|
||||
tags:
|
||||
- apache
|
||||
|
||||
- include: log2mail.yml
|
||||
- ansible.builtin.include: log2mail.yml
|
||||
when: apache_log2mail_include
|
||||
tags:
|
||||
- apache
|
||||
|
||||
- include: munin.yml
|
||||
- ansible.builtin.include: munin.yml
|
||||
when: apache_munin_include | bool
|
||||
tags:
|
||||
- apache
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: "Install munin-node and core plugins packages"
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- munin-node
|
||||
- munin-plugins-core
|
||||
|
@ -11,7 +11,7 @@
|
|||
- munin
|
||||
|
||||
- name: "Enable Munin plugins"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
src: "/usr/share/munin/plugins/{{ item }}"
|
||||
dest: "/etc/munin/plugins/{{ item }}"
|
||||
state: link
|
||||
|
@ -25,7 +25,7 @@
|
|||
- munin
|
||||
|
||||
- name: "Install fcgi packages for Munin graphs"
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- libapache2-mod-fcgid
|
||||
- libcgi-fast-perl
|
||||
|
@ -36,7 +36,8 @@
|
|||
- munin
|
||||
|
||||
- name: "Enable libapache2-mod-fcgid"
|
||||
command: a2enmod fcgid
|
||||
ansible.builtin.command:
|
||||
cmd: a2enmod fcgid
|
||||
register: cmd_enable_fcgid
|
||||
changed_when: "'Module fcgid already enabled' not in cmd_enable_fcgid.stdout"
|
||||
notify: restart apache
|
||||
|
@ -45,7 +46,7 @@
|
|||
- munin
|
||||
|
||||
- name: "Apache has access to /var/log/munin/"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /var/log/munin/
|
||||
group: www-data
|
||||
tags:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: server status dirname exists
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: "{{ apache_serverstatus_suffix_file | dirname }}"
|
||||
mode: "0700"
|
||||
owner: root
|
||||
|
@ -9,7 +9,7 @@
|
|||
state: directory
|
||||
|
||||
- name: set apache serverstatus suffix if provided
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ apache_serverstatus_suffix_file }}"
|
||||
# The last character "\u000A" is a line feed (LF), it's better to keep it
|
||||
content: "{{ apache_serverstatus_suffix }}\u000A"
|
||||
|
@ -17,51 +17,53 @@
|
|||
when: apache_serverstatus_suffix | length > 0
|
||||
|
||||
- name: generate random string for server-status suffix
|
||||
shell: "apg -a 1 -M N -n 1 > {{ apache_serverstatus_suffix_file }}"
|
||||
ansible.builtin.shell:
|
||||
cmd: "apg -a 1 -M N -n 1 > {{ apache_serverstatus_suffix_file }}"
|
||||
args:
|
||||
creates: "{{ apache_serverstatus_suffix_file }}"
|
||||
|
||||
- name: read apache server status suffix
|
||||
command: "tail -n 1 {{ apache_serverstatus_suffix_file }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "tail -n 1 {{ apache_serverstatus_suffix_file }}"
|
||||
changed_when: False
|
||||
check_mode: no
|
||||
register: new_apache_serverstatus_suffix
|
||||
|
||||
- name: overwrite apache_serverstatus_suffix
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
apache_serverstatus_suffix: "{{ new_apache_serverstatus_suffix.stdout }}"
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: apache_serverstatus_suffix
|
||||
verbosity: 1
|
||||
|
||||
- name: replace server-status suffix in default site index
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /var/www/index.html
|
||||
regexp: '__SERVERSTATUS_SUFFIX__'
|
||||
replace: "{{ apache_serverstatus_suffix }}"
|
||||
|
||||
- name: add server-status suffix in default site index if missing
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /var/www/index.html
|
||||
regexp: '"/server-status-?"'
|
||||
replace: '"/server-status-{{ apache_serverstatus_suffix }}"'
|
||||
|
||||
- name: add server-status suffix in default VHost
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/apache2/sites-available/000-evolinux-default.conf
|
||||
regexp: '<Location /server-status-?>'
|
||||
replace: '<Location /server-status-{{ apache_serverstatus_suffix }}>'
|
||||
notify: reload apache
|
||||
|
||||
- name: Munin configuration has a section for apache
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/munin/plugin-conf.d/munin-node
|
||||
line: "[apache_*]"
|
||||
create: no
|
||||
|
||||
- name: apache-status URL is configured for Munin
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/munin/plugin-conf.d/munin-node
|
||||
line: "env.url http://{{ apache_serverstatus_host }}/server-status-{{ apache_serverstatus_suffix }}?auto"
|
||||
regexp: 'env.url http://[^\\/]+/server-status'
|
||||
|
@ -70,7 +72,7 @@
|
|||
notify: restart munin-node
|
||||
|
||||
- name: add mailgraph URL in index.html
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /var/www/index.html
|
||||
state: present
|
||||
line: ' <li><a href="/mailgraph">Stats Mail</a></li>'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Backports deb822 sources list is installed
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: '{{ ansible_distribution_release }}_backports.sources.j2'
|
||||
dest: /etc/apt/sources.list.d/backports.sources
|
||||
force: yes
|
||||
|
@ -11,7 +11,7 @@
|
|||
- apt
|
||||
|
||||
- name: Backports configuration
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: '{{ ansible_distribution_release }}_backports_preferences'
|
||||
dest: /etc/apt/preferences.d/0-backports-defaults
|
||||
force: yes
|
||||
|
@ -21,7 +21,7 @@
|
|||
- apt
|
||||
|
||||
- name: Apt update
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
when: apt_backports_sources is changed or apt_backports_config is changed
|
||||
tags:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: No backports config in default sources.list
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/apt/sources.list
|
||||
regexp: "backports"
|
||||
state: absent
|
||||
|
@ -8,7 +8,7 @@
|
|||
- apt
|
||||
|
||||
- name: Backports sources list is installed
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: '{{ ansible_distribution_release }}_backports.list.j2'
|
||||
dest: /etc/apt/sources.list.d/backports.list
|
||||
force: yes
|
||||
|
@ -18,7 +18,7 @@
|
|||
- apt
|
||||
|
||||
- name: Backports configuration
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: '{{ ansible_distribution_release }}_backports_preferences'
|
||||
dest: /etc/apt/preferences.d/0-backports-defaults
|
||||
force: yes
|
||||
|
@ -28,7 +28,7 @@
|
|||
- apt
|
||||
|
||||
- name: Archived backport are accepted (jessie)
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: '/etc/apt/apt.conf.d/99no-check-valid-until'
|
||||
line: 'Acquire::Check-Valid-Until no;'
|
||||
create: yes
|
||||
|
@ -38,7 +38,7 @@
|
|||
when: ansible_distribution_release == "jessie"
|
||||
|
||||
- name: Apt update
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
tags:
|
||||
- apt
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
# Backward compatibility task file
|
||||
|
||||
- name: Install backports repositories (Debian <12)
|
||||
import_tasks: backports.oneline.yml
|
||||
ansible.builtin.import_tasks: backports.oneline.yml
|
||||
when:
|
||||
- ansible_distribution_major_version is version('12', '<')
|
||||
|
||||
- name: Install backports repositories (Debian >=12)
|
||||
import_tasks: backports.deb822.yml
|
||||
ansible.builtin.import_tasks: backports.deb822.yml
|
||||
when:
|
||||
- ansible_distribution_major_version is version('12', '>=')
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Change basics repositories
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: "{{ ansible_distribution_release }}_basics.sources.j2"
|
||||
dest: /etc/apt/sources.list.d/system.sources
|
||||
mode: "0644"
|
||||
|
@ -11,7 +11,7 @@
|
|||
- apt
|
||||
|
||||
- name: Change security repositories
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: "{{ ansible_distribution_release }}_security.sources.j2"
|
||||
dest: /etc/apt/sources.list.d/security.sources
|
||||
mode: "0644"
|
||||
|
@ -27,7 +27,8 @@
|
|||
register: list_files
|
||||
|
||||
- name: Disable one-line-formatted sources
|
||||
command: "mv --verbose {{ item.path }} {{ item.path }}.bak"
|
||||
ansible.builtin.command:
|
||||
cmd: "mv --verbose {{ item.path }} {{ item.path }}.bak"
|
||||
environment:
|
||||
LC_ALL: C
|
||||
loop: "{{ list_files.files }}"
|
||||
|
@ -37,7 +38,7 @@
|
|||
- apt
|
||||
|
||||
- name: Apt update
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
tags:
|
||||
- apt
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Change basics repositories
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: "{{ ansible_distribution_release }}_basics.list.j2"
|
||||
dest: /etc/apt/sources.list
|
||||
mode: "0644"
|
||||
|
@ -11,7 +11,7 @@
|
|||
- apt
|
||||
|
||||
- name: Apt update
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
tags:
|
||||
- apt
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
# Backward compatibility task file
|
||||
|
||||
- name: Install basics repositories (Debian <12)
|
||||
import_tasks: basics.oneline.yml
|
||||
ansible.builtin.import_tasks: basics.oneline.yml
|
||||
when:
|
||||
- ansible_distribution_major_version is version('12', '<')
|
||||
|
||||
- name: Install basics repositories (Debian >=12)
|
||||
import_tasks: basics.deb822.yml
|
||||
ansible.builtin.import_tasks: basics.deb822.yml
|
||||
when:
|
||||
- ansible_distribution_major_version is version('12', '>=')
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Evolinux config for APT
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/apt/apt.conf.d/z-evolinux.conf
|
||||
line: "{{ item.line }}"
|
||||
regexp: "{{ item.regexp }}"
|
||||
|
@ -17,7 +17,7 @@
|
|||
when: apt_evolinux_config | bool
|
||||
|
||||
- name: DPkg invoke hooks
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/apt/apt.conf.d/z-evolinux.conf
|
||||
line: "{{ item }}"
|
||||
create: yes
|
||||
|
@ -33,7 +33,7 @@
|
|||
when: apt_hooks | bool
|
||||
|
||||
- name: Remove Aptitude
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: aptitude
|
||||
state: absent
|
||||
tags:
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
|
||||
- name: Look for legacy apt keyring
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /etc/apt/trusted.gpg
|
||||
register: _trusted_gpg_keyring
|
||||
tags:
|
||||
- apt
|
||||
|
||||
- name: Evolix embedded GPG key is absent
|
||||
apt_key:
|
||||
ansible.builtin.apt_key:
|
||||
id: "B8612B5D"
|
||||
keyring: /etc/apt/trusted.gpg
|
||||
state: absent
|
||||
|
@ -17,7 +17,7 @@
|
|||
when: _trusted_gpg_keyring.stat.exists
|
||||
|
||||
- name: Add Evolix GPG key
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: pub_evolix.asc
|
||||
dest: "{{ apt_keyring_dir }}/pub_evolix.asc"
|
||||
force: yes
|
||||
|
@ -28,7 +28,7 @@
|
|||
- apt
|
||||
|
||||
- name: Evolix public list is installed
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: evolix_public.sources.j2
|
||||
dest: /etc/apt/sources.list.d/evolix_public.sources
|
||||
force: yes
|
||||
|
@ -38,7 +38,7 @@
|
|||
- apt
|
||||
|
||||
- name: Apt update
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
tags:
|
||||
- apt
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
|
||||
- name: Look for legacy apt keyring
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /etc/apt/trusted.gpg
|
||||
register: _trusted_gpg_keyring
|
||||
tags:
|
||||
- apt
|
||||
|
||||
- name: Evolix embedded GPG key is absent
|
||||
apt_key:
|
||||
ansible.builtin.apt_key:
|
||||
id: "B8612B5D"
|
||||
keyring: /etc/apt/trusted.gpg
|
||||
state: absent
|
||||
|
@ -17,7 +17,7 @@
|
|||
when: _trusted_gpg_keyring.stat.exists
|
||||
|
||||
- name: Add Evolix GPG key
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: pub_evolix.asc
|
||||
dest: "{{ apt_keyring_dir }}/pub_evolix.asc"
|
||||
force: yes
|
||||
|
@ -28,7 +28,7 @@
|
|||
- apt
|
||||
|
||||
- name: Evolix public list is installed
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: evolix_public.list.j2
|
||||
dest: /etc/apt/sources.list.d/evolix_public.list
|
||||
force: yes
|
||||
|
@ -38,7 +38,7 @@
|
|||
- apt
|
||||
|
||||
- name: Apt update
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
tags:
|
||||
- apt
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
# Backward compatibility task file
|
||||
|
||||
- name: Install Evolix Public repositories (Debian <12)
|
||||
import_tasks: evolix_public.oneline.yml
|
||||
ansible.builtin.import_tasks: evolix_public.oneline.yml
|
||||
when:
|
||||
- ansible_distribution_major_version is version('12', '<')
|
||||
|
||||
- name: Install Evolix Public repositories (Debian >=12)
|
||||
import_tasks: evolix_public.deb822.yml
|
||||
ansible.builtin.import_tasks: evolix_public.deb822.yml
|
||||
when:
|
||||
- ansible_distribution_major_version is version('12', '>=')
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
|
||||
- name: "hold packages (apt)"
|
||||
shell: "set -o pipefail && (dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) || apt-mark hold {{ item }})"
|
||||
args:
|
||||
ansible.builtin.shell:
|
||||
cmd: "set -o pipefail && (dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) || apt-mark hold {{ item }})"
|
||||
executable: /bin/bash
|
||||
check_mode: no
|
||||
register: apt_mark
|
||||
|
@ -18,7 +18,7 @@
|
|||
- apt
|
||||
|
||||
- name: "/etc/evolinux is present"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: /etc/evolinux
|
||||
mode: "0700"
|
||||
state: directory
|
||||
|
@ -26,7 +26,7 @@
|
|||
- apt
|
||||
|
||||
- name: "hold packages (config)"
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/evolinux/apt_hold_packages.cf
|
||||
line: "{{ item }}"
|
||||
create: True
|
||||
|
@ -36,8 +36,8 @@
|
|||
- apt
|
||||
|
||||
- name: "unhold packages (apt)"
|
||||
shell: "set -o pipefail && (dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) && apt-mark unhold {{ item }})"
|
||||
args:
|
||||
ansible.builtin.shell:
|
||||
cmd: "set -o pipefail && (dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) && apt-mark unhold {{ item }})"
|
||||
executable: /bin/bash
|
||||
check_mode: no
|
||||
register: apt_mark
|
||||
|
@ -48,7 +48,7 @@
|
|||
- apt
|
||||
|
||||
- name: "unhold packages (config)"
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/evolinux/apt_hold_packages.cf
|
||||
line: "{{ item }}"
|
||||
create: True
|
||||
|
@ -58,7 +58,7 @@
|
|||
- apt
|
||||
|
||||
- name: /usr/share/scripts exists
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: /usr/share/scripts
|
||||
mode: "0700"
|
||||
owner: root
|
||||
|
@ -68,7 +68,7 @@
|
|||
- apt
|
||||
|
||||
- name: Check scripts is installed
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: check_held_packages.sh
|
||||
dest: /usr/share/scripts/check_held_packages.sh
|
||||
force: yes
|
||||
|
@ -77,7 +77,8 @@
|
|||
- apt
|
||||
|
||||
- name: Check if Cron is installed
|
||||
shell: "dpkg --list 'cron' 2>/dev/null | grep -q -E '^(i|h)i'"
|
||||
ansible.builtin.shell:
|
||||
cmd: "dpkg --list 'cron' 2>/dev/null | grep -q -E '^(i|h)i'"
|
||||
register: is_cron
|
||||
changed_when: False
|
||||
failed_when: False
|
||||
|
@ -86,7 +87,7 @@
|
|||
- apt
|
||||
|
||||
- name: Check for held packages (script)
|
||||
cron:
|
||||
ansible.builtin.cron:
|
||||
cron_file: apt-hold-packages
|
||||
name: check_held_packages
|
||||
job: "/usr/share/scripts/check_held_packages.sh"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: "Compatibility check"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version is version('8', '>=')
|
||||
|
@ -10,7 +10,7 @@
|
|||
- apt
|
||||
|
||||
- name: "apt-transport-https is installed for https repositories (before Buster)"
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- apt-transport-https
|
||||
tags:
|
||||
|
@ -18,20 +18,20 @@
|
|||
when: ansible_distribution_major_version is version('10', '<')
|
||||
|
||||
- name: "certificates are installed for https repositories"
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- ca-certificates
|
||||
tags:
|
||||
- apt
|
||||
|
||||
- name: Custom configuration
|
||||
import_tasks: config.yml
|
||||
ansible.builtin.import_tasks: config.yml
|
||||
when: apt_config | bool
|
||||
tags:
|
||||
- apt
|
||||
|
||||
- name: Install basics repositories (Debian <12)
|
||||
import_tasks: basics.oneline.yml
|
||||
ansible.builtin.import_tasks: basics.oneline.yml
|
||||
tags:
|
||||
- apt
|
||||
when:
|
||||
|
@ -39,7 +39,7 @@
|
|||
- ansible_distribution_major_version is version('12', '<')
|
||||
|
||||
- name: Install basics repositories (Debian >=12)
|
||||
import_tasks: basics.deb822.yml
|
||||
ansible.builtin.import_tasks: basics.deb822.yml
|
||||
tags:
|
||||
- apt
|
||||
when:
|
||||
|
@ -47,7 +47,7 @@
|
|||
- ansible_distribution_major_version is version('12', '>=')
|
||||
|
||||
- name: Install backports repositories (Debian <12)
|
||||
import_tasks: backports.oneline.yml
|
||||
ansible.builtin.import_tasks: backports.oneline.yml
|
||||
tags:
|
||||
- apt
|
||||
when:
|
||||
|
@ -57,7 +57,7 @@
|
|||
# With Debian 12+ and the deb822 format of source files
|
||||
# backports are always installed but enabled according to `apt_install_backports`
|
||||
- name: Install backports repositories (Debian >=12)
|
||||
import_tasks: backports.deb822.yml
|
||||
ansible.builtin.import_tasks: backports.deb822.yml
|
||||
tags:
|
||||
- apt
|
||||
when:
|
||||
|
@ -65,7 +65,7 @@
|
|||
|
||||
|
||||
- name: Install Evolix Public repositories (Debian <12)
|
||||
import_tasks: evolix_public.oneline.yml
|
||||
ansible.builtin.import_tasks: evolix_public.oneline.yml
|
||||
tags:
|
||||
- apt
|
||||
when:
|
||||
|
@ -73,7 +73,7 @@
|
|||
- ansible_distribution_major_version is version('12', '<')
|
||||
|
||||
- name: Install Evolix Public repositories (Debian >=12)
|
||||
import_tasks: evolix_public.deb822.yml
|
||||
ansible.builtin.import_tasks: evolix_public.deb822.yml
|
||||
tags:
|
||||
- apt
|
||||
when:
|
||||
|
@ -81,7 +81,7 @@
|
|||
- ansible_distribution_major_version is version('12', '>=')
|
||||
|
||||
- name: Clean GANDI sources
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: '{{ item }}'
|
||||
state: absent
|
||||
loop:
|
||||
|
@ -97,20 +97,20 @@
|
|||
|
||||
|
||||
- name: Install check for packages marked hold
|
||||
import_tasks: hold_packages.yml
|
||||
ansible.builtin.import_tasks: hold_packages.yml
|
||||
when: apt_install_hold_packages | bool
|
||||
tags:
|
||||
- apt
|
||||
|
||||
- name: Updating APT cache
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
changed_when: False
|
||||
tags:
|
||||
- apt
|
||||
|
||||
- name: Upgrading system
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
upgrade: dist
|
||||
when: apt_upgrade | bool
|
||||
tags:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
|
||||
- name: /usr/share/scripts exists
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: /usr/share/scripts
|
||||
mode: "0700"
|
||||
owner: root
|
||||
|
@ -13,7 +13,7 @@
|
|||
- apt
|
||||
|
||||
- name: Migration scripts are installed
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/usr/share/scripts/{{ item }}"
|
||||
force: yes
|
||||
|
@ -25,7 +25,8 @@
|
|||
- apt
|
||||
|
||||
- name: Exec migration script
|
||||
command: /usr/share/scripts/deb822-migration.sh
|
||||
ansible.builtin.command:
|
||||
cmd: /usr/share/scripts/deb822-migration.sh
|
||||
ignore_errors: yes
|
||||
tags:
|
||||
- apt
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
|
||||
- name: New APT keyrings directory is present
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /etc/apt/keyrings
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
|
||||
- name: /usr/share/scripts exists
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: /usr/share/scripts
|
||||
mode: "0700"
|
||||
owner: root
|
||||
|
@ -22,7 +22,7 @@
|
|||
- apt
|
||||
|
||||
- name: migration script is present
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: move-apt-keyrings.sh
|
||||
dest: /usr/share/scripts/move-apt-keyrings.sh
|
||||
mode: "0755"
|
||||
|
@ -30,7 +30,8 @@
|
|||
group: root
|
||||
|
||||
- name: Move repository signing key
|
||||
command: "/usr/share/scripts/move-apt-keyrings.sh \"{{ item.repository_pattern }}\" \"{{ item.key }}\""
|
||||
ansible.builtin.command:
|
||||
cmd: "/usr/share/scripts/move-apt-keyrings.sh \"{{ item.repository_pattern }}\" \"{{ item.key }}\""
|
||||
loop:
|
||||
- { repository_pattern: "http://pub.evolix.net/", key: "reg.asc" }
|
||||
- { repository_pattern: "http://pub.evolix.org/evolix", key: "pub_evolix.asc" }
|
||||
|
@ -48,5 +49,5 @@
|
|||
register: _cmd
|
||||
|
||||
- name: Debug command
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: _cmd
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
---
|
||||
- name: reload systemd
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
daemon-reload: yes
|
||||
|
||||
|
||||
- name: restart apparmor
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: apparmor
|
||||
state: restarted
|
||||
|
||||
- name: restart bind
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: bind9
|
||||
state: restarted
|
||||
|
||||
- name: restart munin-node
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: munin-node
|
||||
state: restarted
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Set bind configuration for authoritative server
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: named.conf.options_authoritative.j2
|
||||
dest: /etc/bind/named.conf.options
|
||||
owner: bind
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Until chroot-bind.sh is migrated to ansible, we hardcode the chroot paths.
|
||||
- name: set chroot variables
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
bind_log_file: /var/log/bind.log
|
||||
bind_query_file: /var/log/bind_queries.log
|
||||
bind_cache_dir: /var/cache/bind
|
||||
|
@ -9,14 +9,15 @@
|
|||
when: bind_chroot_set | bool
|
||||
|
||||
- name: Check AppArmor
|
||||
shell: systemctl is-active apparmor || systemctl is-enabled apparmor
|
||||
ansible.builtin.shell:
|
||||
cmd: systemctl is-active apparmor || systemctl is-enabled apparmor
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
check_mode: no
|
||||
register: check_apparmor
|
||||
|
||||
- name: configure apparmor
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: apparmor.usr.sbin.named.j2
|
||||
dest: /etc/apparmor.d/usr.sbin.named
|
||||
owner: root
|
||||
|
@ -27,20 +28,20 @@
|
|||
when: check_apparmor.rc == 0
|
||||
|
||||
- name: package are installed
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- bind9
|
||||
- dnstop
|
||||
state: present
|
||||
|
||||
- include: authoritative.yml
|
||||
- ansible.builtin.include: authoritative.yml
|
||||
when: bind_authoritative_server | bool
|
||||
|
||||
- include: recursive.yml
|
||||
- ansible.builtin.include: recursive.yml
|
||||
when: bind_recursive_server | bool
|
||||
|
||||
- name: Create systemd service for Debian 8 (Jessie)
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: bind9.service.jessie.j2
|
||||
dest: "{{ bind_systemd_service_path }}"
|
||||
owner: root
|
||||
|
@ -53,7 +54,7 @@
|
|||
when: ansible_distribution_release == "jessie"
|
||||
|
||||
- name: "touch {{ bind_log_file }} if non chroot"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind_log_file }}"
|
||||
owner: bind
|
||||
group: adm
|
||||
|
@ -62,7 +63,7 @@
|
|||
when: not (bind_chroot_set | bool)
|
||||
|
||||
- name: "touch {{ bind_query_file }} if non chroot"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind_query_file }}"
|
||||
owner: bind
|
||||
group: adm
|
||||
|
@ -71,7 +72,7 @@
|
|||
when: not (bind_chroot_set | bool)
|
||||
|
||||
- name: send chroot-bind.sh in /root
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: chroot-bind.sh
|
||||
dest: /root/chroot-bind.sh
|
||||
mode: "0700"
|
||||
|
@ -81,19 +82,20 @@
|
|||
when: bind_chroot_set | bool
|
||||
|
||||
- name: exec chroot-bind.sh
|
||||
command: "/root/chroot-bind.sh"
|
||||
ansible.builtin.command:
|
||||
cmd: "/root/chroot-bind.sh"
|
||||
register: chrootbind_run
|
||||
changed_when: False
|
||||
when: bind_chroot_set | bool
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: chrootbind_run.stdout_lines
|
||||
when:
|
||||
- bind_chroot_set | bool
|
||||
- chrootbind_run.stdout | length > 0
|
||||
|
||||
- name: Modify OPTIONS in /etc/default/bind9 for chroot
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/default/bind9
|
||||
regexp: '^OPTIONS=.*'
|
||||
replace: 'OPTIONS="-u bind -t {{ bind_chroot_path }}"'
|
||||
|
@ -101,7 +103,7 @@
|
|||
when: bind_chroot_set | bool
|
||||
|
||||
- name: logrotate for bind
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: logrotate_bind.j2
|
||||
dest: /etc/logrotate.d/bind9
|
||||
owner: root
|
||||
|
@ -110,4 +112,4 @@
|
|||
force: yes
|
||||
notify: restart bind
|
||||
|
||||
- include: munin.yml
|
||||
- ansible.builtin.include: munin.yml
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: is Munin present ?
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /etc/munin/plugin-conf.d/munin-node
|
||||
check_mode: no
|
||||
register: munin_node_plugins_config
|
||||
|
@ -10,7 +10,7 @@
|
|||
- munin
|
||||
|
||||
- name: Enable munin plugins for authoritative server
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
src: "/usr/share/munin/plugins/{{ item }}"
|
||||
dest: "/etc/munin/plugins/{{ item }}"
|
||||
state: link
|
||||
|
@ -18,31 +18,31 @@
|
|||
- bind9
|
||||
- bind9_rndc
|
||||
notify: restart munin-node
|
||||
when:
|
||||
- bind_authoritative_server | bool
|
||||
- munin_node_plugins_config.stat.exists
|
||||
tags:
|
||||
- bind
|
||||
- munin
|
||||
when:
|
||||
- bind_authoritative_server | bool
|
||||
- munin_node_plugins_config.stat.exists
|
||||
|
||||
- name: Enable munin plugins for recursive server
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
src: "/usr/share/munin/plugins/{{ item }}"
|
||||
dest: "/etc/munin/plugins/{{ item }}"
|
||||
state: link
|
||||
loop:
|
||||
- bind9
|
||||
notify: restart munin-node
|
||||
tags:
|
||||
- bind
|
||||
- munin
|
||||
when:
|
||||
- bind_recursive_server | bool
|
||||
- bind_query_file_enabled | bool
|
||||
- munin_node_plugins_config.stat.exists
|
||||
tags:
|
||||
- bind
|
||||
- munin
|
||||
|
||||
- name: Add munin plugin configuration
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: munin-env_bind9.j2
|
||||
dest: /etc/munin/plugin-conf.d/bind9
|
||||
owner: root
|
||||
|
@ -50,7 +50,7 @@
|
|||
mode: "0644"
|
||||
force: yes
|
||||
notify: restart munin-node
|
||||
when: munin_node_plugins_config.stat.exists
|
||||
tags:
|
||||
- bind
|
||||
- munin
|
||||
when: munin_node_plugins_config.stat.exists
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
- name: Set bind configuration for recursive server
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: named.conf.options_recursive.j2
|
||||
dest: /etc/bind/named.conf.options
|
||||
owner: bind
|
||||
|
@ -12,7 +12,7 @@
|
|||
notify: restart bind
|
||||
|
||||
- name: enable zones.rfc1918 for recursive server
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/bind/named.conf.local
|
||||
line: 'include "/etc/bind/zones.rfc1918";'
|
||||
regexp: "zones.rfc1918"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: ansible_lsb
|
||||
|
||||
# Force facts until Debian 12 is released because Ansible is dumb
|
||||
- set_fact:
|
||||
- ansible.builtin.set_fact:
|
||||
ansible_distribution_major_version: 12
|
||||
ansible_distribution: "Debian"
|
||||
ansible_distribution_release: "bookworm"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
# Force facts until Debian 11 is released because Ansible is dumb
|
||||
- set_fact:
|
||||
- ansible.builtin.set_fact:
|
||||
ansible_distribution_major_version: 11
|
||||
ansible_distribution: "Debian"
|
||||
ansible_distribution_release: "bullseye"
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
---
|
||||
|
||||
- name: reload nginx
|
||||
service:
|
||||
ansible.builtin.systemd:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
|
||||
- name: reload apache
|
||||
service:
|
||||
ansible.builtin.systemd:
|
||||
name: apache2
|
||||
state: reloaded
|
||||
|
||||
- name: reload haproxy
|
||||
service:
|
||||
ansible.builtin.systemd:
|
||||
name: haproxy
|
||||
state: reloaded
|
||||
|
||||
- name: systemd daemon-reload
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: yes
|
||||
|
||||
- name: install letsencrypt-auto
|
||||
command: /usr/local/bin/letsencrypt-auto --noninteractive --install-only --no-self-upgrade
|
||||
ansible.builtin.command:
|
||||
cmd: /usr/local/bin/letsencrypt-auto --noninteractive --install-only --no-self-upgrade
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
|
||||
- name: Certbot work directory is present
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: "{{ certbot_work_dir }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Check if Nginx is installed
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /etc/nginx
|
||||
register: is_nginx
|
||||
|
||||
- name: ACME challenge for Nginx is installed
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: acme-challenge/nginx.conf.j2
|
||||
dest: /etc/nginx/snippets/letsencrypt.conf
|
||||
force: yes
|
||||
|
@ -20,32 +20,33 @@
|
|||
when: is_nginx.stat.exists
|
||||
|
||||
- name: Check if Apache is installed
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /usr/sbin/apachectl
|
||||
register: is_apache
|
||||
|
||||
- name: ACME challenge for Apache
|
||||
block:
|
||||
- name: ACME challenge for Apache is installed
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: acme-challenge/apache.conf.j2
|
||||
dest: /etc/apache2/conf-available/letsencrypt.conf
|
||||
force: yes
|
||||
notify: reload apache
|
||||
|
||||
- name: ACME challenge for Apache is enabled
|
||||
command: "a2enconf letsencrypt"
|
||||
ansible.builtin.command:
|
||||
cmd: "a2enconf letsencrypt"
|
||||
register: command_result
|
||||
changed_when: "'Enabling' in command_result.stderr"
|
||||
notify: reload apache
|
||||
when: is_apache.stat.exists
|
||||
|
||||
- name: Check if HAProxy is installed
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /etc/haproxy
|
||||
register: is_haproxy
|
||||
|
||||
- name: ACME challenge for HAProxy is installed
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "ACME challenge configuration for HAProxy must be configured manually"
|
||||
when: is_haproxy.stat.exists
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
---
|
||||
|
||||
- name: certbot package is removed
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: certbot
|
||||
state: absent
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
|
||||
# copied and customized from https://raw.githubusercontent.com/certbot/certbot/v1.14.0/letsencrypt-auto
|
||||
- name: Let's Encrypt script is present
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: letsencrypt-auto
|
||||
dest: /usr/local/bin/letsencrypt-auto
|
||||
mode: '0755'
|
||||
|
@ -20,22 +20,23 @@
|
|||
notify: install letsencrypt-auto
|
||||
|
||||
- name: Check certbot script
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /usr/local/bin/certbot
|
||||
register: certbot_path
|
||||
|
||||
- name: Rename certbot script if present
|
||||
command: "mv /usr/local/bin/certbot /usr/local/bin/certbot.bak"
|
||||
ansible.builtin.command:
|
||||
cmd: "mv /usr/local/bin/certbot /usr/local/bin/certbot.bak"
|
||||
when: certbot_path.stat.exists
|
||||
|
||||
- name: Let's Encrypt script is symlinked as certbot
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
src: "/usr/local/bin/letsencrypt-auto"
|
||||
dest: "/usr/local/bin/certbot"
|
||||
state: link
|
||||
|
||||
- name: systemd artefacts are absent
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: "{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
|
@ -45,14 +46,14 @@
|
|||
notify: systemd daemon-reload
|
||||
|
||||
- name: custom crontab is present
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: cron_jessie
|
||||
dest: /etc/cron.d/certbot
|
||||
force: yes
|
||||
when: certbot_custom_crontab | bool
|
||||
|
||||
- name: disable self-upgrade
|
||||
ini_file:
|
||||
community.general.ini_file:
|
||||
dest: "/etc/letsencrypt/cli.ini"
|
||||
section: null
|
||||
option: "no-self-upgrade"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
|
||||
- name: certbot package is installed
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: certbot
|
||||
state: latest
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
---
|
||||
|
||||
- name: "System compatibility checks"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version is version('8', '>=')
|
||||
msg: only compatible with Debian 9+
|
||||
|
||||
- name: Install legacy script on Debian 8
|
||||
include: install-legacy.yml
|
||||
ansible.builtin.include: install-legacy.yml
|
||||
when:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version is version('9', '<')
|
||||
|
||||
- name: Install package on Debian 9+
|
||||
include: install-package.yml
|
||||
ansible.builtin.include: install-package.yml
|
||||
when:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version is version('9', '>=')
|
||||
|
||||
- include: acme-challenge.yml
|
||||
- ansible.builtin.include: acme-challenge.yml
|
||||
|
||||
- name: Deploy hooks are present
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: hooks/deploy/
|
||||
dest: /etc/letsencrypt/renewal-hooks/deploy/
|
||||
mode: "0700"
|
||||
|
@ -30,7 +30,7 @@
|
|||
group: root
|
||||
|
||||
- name: Manual deploy hook is present
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: hooks/manual-deploy.sh
|
||||
dest: /etc/letsencrypt/renewal-hooks/manual-deploy.sh
|
||||
mode: "0700"
|
||||
|
@ -38,7 +38,7 @@
|
|||
group: root
|
||||
|
||||
- name: "sync_remote is configured with servers"
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/letsencrypt/renewal-hooks/deploy/sync_remote.cf
|
||||
regexp: "^servers="
|
||||
line: "servers=\"{{ certbot_hooks_sync_remote_servers | join(' ') }}\""
|
||||
|
@ -46,14 +46,15 @@
|
|||
|
||||
# begining of backward compatibility tasks
|
||||
- name: Move deploy/commit-etc.sh to deploy/z-commit-etc.sh if present
|
||||
command: "mv /etc/letsencrypt/renewal-hooks/deploy/commit-etc.sh /etc/letsencrypt/renewal-hooks/deploy/z-commit-etc.sh"
|
||||
ansible.builtin.command:
|
||||
cmd: "mv /etc/letsencrypt/renewal-hooks/deploy/commit-etc.sh /etc/letsencrypt/renewal-hooks/deploy/z-commit-etc.sh"
|
||||
args:
|
||||
removes: /etc/letsencrypt/renewal-hooks/deploy/commit-etc.sh
|
||||
creates: /etc/letsencrypt/renewal-hooks/deploy/z-commit-etc.sh
|
||||
# end of backward compatibility tasks
|
||||
|
||||
- name: "certbot lock is ignored by Git"
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/.gitignore
|
||||
line: letsencrypt/.certbot.lock
|
||||
create: yes
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: restart clamav
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: clamav-daemon
|
||||
state: restarted
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: configure clamav-daemon
|
||||
debconf:
|
||||
ansible.builtin.debconf:
|
||||
name: clamav-daemon
|
||||
question: "{{ item.key }}"
|
||||
value: "{{ item.value }}"
|
||||
|
@ -52,7 +52,7 @@
|
|||
- clamav
|
||||
|
||||
- name: configure clamav-freshclam
|
||||
debconf:
|
||||
ansible.builtin.debconf:
|
||||
name: clamav-freshclam
|
||||
question: "{{ item.key }}"
|
||||
value: "{{ item.value }}"
|
||||
|
@ -73,7 +73,7 @@
|
|||
- clamav
|
||||
|
||||
- name: install ClamAV
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- clamav-daemon
|
||||
- clamav
|
||||
|
@ -92,7 +92,7 @@
|
|||
- clamav
|
||||
|
||||
- name: add clamav user to amavis group
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: clamav
|
||||
groups: amavis
|
||||
append: True
|
||||
|
@ -100,7 +100,7 @@
|
|||
- clamav
|
||||
|
||||
- name: allow supplementary groups
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/clamav/clamd.conf
|
||||
regexp: 'AllowSupplementaryGroups false'
|
||||
replace: 'AllowSupplementaryGroups true'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: restart dhcp
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: isc-dhcp-server
|
||||
state: restarted
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: ensure packages are installed
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: isc-dhcp-server
|
||||
state: present
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
- name: reload systemd
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
daemon-reload: yes
|
||||
|
||||
- name: restart docker
|
||||
service:
|
||||
ansible.builtin.systemd:
|
||||
name: docker
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
---
|
||||
- name: restart dovecot
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: dovecot
|
||||
state: restarted
|
||||
|
||||
- name: reload dovecot
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: dovecot
|
||||
state: reloaded
|
||||
|
||||
- name: restart log2mail
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: log2mail
|
||||
state: restarted
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: ensure packages are installed
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- dovecot-ldap
|
||||
- dovecot-imapd
|
||||
|
@ -11,12 +11,12 @@
|
|||
- dovecot
|
||||
|
||||
- name: Generate 4096 bits Diffie-Hellman parameters (may take several minutes)
|
||||
openssl_dhparam:
|
||||
community.crypto.openssl_dhparam:
|
||||
path: /etc/ssl/dhparams.pem
|
||||
size: 4096
|
||||
|
||||
- name: disable pam auth
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/dovecot/conf.d/10-auth.conf
|
||||
regexp: "[^#]!include auth-system.conf.ext"
|
||||
replace: "#!include auth-system.conf.ext"
|
||||
|
@ -24,7 +24,7 @@
|
|||
- dovecot
|
||||
|
||||
- name: update ldap auth
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/dovecot/dovecot-ldap.conf.ext
|
||||
line: "{{ item.key }} = {{ item.value }}"
|
||||
regexp: "^#*{{ item.key }}"
|
||||
|
@ -43,7 +43,7 @@
|
|||
- dovecot
|
||||
|
||||
- name: create vmail group
|
||||
group:
|
||||
ansible.builtin.group:
|
||||
name: vmail
|
||||
gid: "{{ dovecot_vmail_gid }}"
|
||||
system: True
|
||||
|
@ -51,7 +51,7 @@
|
|||
- dovecot
|
||||
|
||||
- name: create vmail user
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: vmail
|
||||
group: vmail
|
||||
uid: "{{ dovecot_vmail_uid }}"
|
||||
|
@ -61,7 +61,7 @@
|
|||
- dovecot
|
||||
|
||||
- name: deploy evolix config
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: z-evolinux-defaults.conf.j2
|
||||
dest: /etc/dovecot/conf.d/z-evolinux-defaults.conf
|
||||
mode: "0644"
|
||||
|
@ -70,7 +70,7 @@
|
|||
- dovecot
|
||||
|
||||
- name: deploy file for custom configuration
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: zzz-evolinux-custom.conf.j2
|
||||
dest: /etc/dovecot/conf.d/zzz-evolinux-custom.conf
|
||||
mode: "0644"
|
||||
|
@ -78,18 +78,18 @@
|
|||
tags:
|
||||
- dovecot
|
||||
|
||||
- include: munin.yml
|
||||
- ansible.builtin.include: munin.yml
|
||||
tags:
|
||||
- dovecot
|
||||
- dovecot
|
||||
|
||||
- name: log2mail is installed
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: log2mail
|
||||
state: present
|
||||
tags: dovecot
|
||||
|
||||
- name: dovecot is configured in log2mail
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/log2mail/config/mail.conf
|
||||
create: true
|
||||
owner: log2mail
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: is Munin present ?
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /etc/munin/plugin-conf.d/munin-node
|
||||
check_mode: no
|
||||
register: munin_node_plugins_config
|
||||
|
@ -9,13 +9,13 @@
|
|||
- name: Munin plugins are present and configured
|
||||
block:
|
||||
- name: Install munin plugin
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: munin_plugin
|
||||
dest: /etc/munin/plugins/dovecot
|
||||
mode: "0755"
|
||||
|
||||
- name: Install munin config
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: munin_config
|
||||
dest: /etc/munin/plugin-conf.d/dovecot
|
||||
mode: "0644"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: restart munin-node
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: munin-node
|
||||
state: restarted
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- include: packages.yml
|
||||
- ansible.builtin.include: packages.yml
|
||||
|
||||
- include: munin.yml
|
||||
- ansible.builtin.include: munin.yml
|
||||
|
||||
- include: nagios.yml
|
||||
- ansible.builtin.include: nagios.yml
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Check if Munin plugins exists
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /etc/munin/plugins/
|
||||
register: munin_plugins_dir
|
||||
check_mode: no
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
# https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/drbd/drbd
|
||||
- name: Get Munin plugin
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: munin/drbd-plugin
|
||||
dest: /etc/munin/plugins/drbd
|
||||
mode: "0755"
|
||||
|
@ -20,7 +20,7 @@
|
|||
- drbd
|
||||
|
||||
- name: Copy Munin plugin conf
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: munin/drbd-config
|
||||
dest: /etc/munin/plugin-conf.d/drbd
|
||||
mode: "0644"
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
---
|
||||
|
||||
- name: Check if Nagios is installed
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /usr/local/lib/nagios/plugins/
|
||||
register: nagios_plugins_dir
|
||||
check_mode: no
|
||||
tags:
|
||||
- drbd
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
tags:
|
||||
- drbd
|
||||
|
||||
# https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=3367&cf_id=30
|
||||
- name: Install Nagios plugin
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "nagios/check_drbd"
|
||||
dest: "/usr/local/lib/nagios/plugins/check_drbd"
|
||||
mode: "0755"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: Install dependency
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- drbd-utils
|
||||
- lvm2
|
||||
|
@ -7,7 +7,7 @@
|
|||
- drbd
|
||||
|
||||
- name: Enable drbd.service
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: drbd
|
||||
enabled: yes
|
||||
tags:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: restart elasticsearch
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: yes
|
||||
name: elasticsearch
|
||||
state: restarted
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
when: elasticsearch_additional_scripts_dir is search("/usr")
|
||||
|
||||
- name: "{{ elasticsearch_additional_scripts_dir }} exists"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: "{{ elasticsearch_additional_scripts_dir }}"
|
||||
mode: "0700"
|
||||
owner: root
|
||||
|
@ -13,7 +13,7 @@
|
|||
state: directory
|
||||
|
||||
- name: Plugins upgrade script is installed
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: upgrade_elasticsearch_plugins.sh
|
||||
dest: "{{ elasticsearch_additional_scripts_dir }}/upgrade_elasticsearch_plugins.sh"
|
||||
mode: "0755"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
|
||||
- name: Read maximum map count
|
||||
command: "sysctl -n vm.max_map_count"
|
||||
ansible.builtin.command:
|
||||
cmd: "sysctl -n vm.max_map_count"
|
||||
register: max_map_count
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
|
@ -9,7 +10,7 @@
|
|||
- config
|
||||
|
||||
- name: Maximum map count check
|
||||
sysctl:
|
||||
ansible.posix.sysctl:
|
||||
name: vm.max_map_count
|
||||
value: 262144
|
||||
sysctl_file: /etc/sysctl.d/elasticsearch.conf
|
||||
|
@ -18,7 +19,7 @@
|
|||
- config
|
||||
|
||||
- name: bootstrap.memory_lock
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "bootstrap.memory_lock: true"
|
||||
regexp: "^bootstrap.memory_lock:"
|
||||
|
@ -27,12 +28,12 @@
|
|||
- config
|
||||
|
||||
- name: Create a system config directory for systemd overrides
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/system/elasticsearch.service.d
|
||||
state: directory
|
||||
|
||||
- name: Override memory config in systemd unit
|
||||
ini_file:
|
||||
community.general.ini_file:
|
||||
dest: /etc/systemd/system/elasticsearch.service.d/elasticsearch.conf
|
||||
section: Service
|
||||
option: "LimitMEMLOCK"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Configure cluster name
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "cluster.name: {{ elasticsearch_cluster_name }}"
|
||||
regexp: "^cluster.name:"
|
||||
|
@ -11,7 +11,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure node name
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "node.name: {{ elasticsearch_node_name }}"
|
||||
regexp: "^node.name:"
|
||||
|
@ -20,7 +20,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure network host
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "network.host: {{ elasticsearch_network_host }}"
|
||||
regexp: "^network.host:"
|
||||
|
@ -30,7 +30,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure network publish_host
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "network.publish_host: {{ elasticsearch_network_publish_host }}"
|
||||
regexp: "^network.publish_host:"
|
||||
|
@ -40,7 +40,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure http publish_host
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "http.publish_host: {{ elasticsearch_http_publish_host }}"
|
||||
regexp: "^http.publish_host:"
|
||||
|
@ -50,7 +50,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure discovery seed hosts
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "discovery.seed_hosts: {{ elasticsearch_discovery_seed_hosts | to_yaml(default_flow_style=True) }}"
|
||||
regexp: "^discovery.seed_hosts:"
|
||||
|
@ -59,7 +59,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure empty discovery seed hosts
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
regexp: "^discovery.seed_hosts:"
|
||||
state: absent
|
||||
|
@ -68,7 +68,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure initial master nodes
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "cluster.initial_master_nodes: {{ elasticsearch_cluster_initial_master_nodes | to_yaml(default_flow_style=True) }}"
|
||||
regexp: "^cluster.initial_master_nodes:"
|
||||
|
@ -77,7 +77,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure empty initial master nodes
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
regexp: "^cluster.initial_master_nodes:"
|
||||
state: absent
|
||||
|
@ -86,7 +86,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure RESTART_ON_UPGRADE
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/default/elasticsearch
|
||||
line: "RESTART_ON_UPGRADE={{ elasticsearch_restart_on_upgrade | bool | ternary('true','false') }}"
|
||||
regexp: "^RESTART_ON_UPGRADE="
|
||||
|
@ -95,7 +95,7 @@
|
|||
- config
|
||||
|
||||
- name: JVM Heap size (min) is set
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/jvm.options.d/evolinux.options
|
||||
regexp: "^-Xms"
|
||||
line: "-Xms{{ elasticsearch_jvm_xms }}"
|
||||
|
@ -107,7 +107,7 @@
|
|||
- config
|
||||
|
||||
- name: JVM Heap size (max) is set
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/jvm.options.d/evolinux.options
|
||||
regexp: "^-Xmx"
|
||||
line: "-Xmx{{ elasticsearch_jvm_xmx }}"
|
||||
|
@ -119,7 +119,7 @@
|
|||
- config
|
||||
|
||||
- name: Disable garbage collector logs (JDK >= 9)
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/jvm.options
|
||||
regexp: "Xlog:gc"
|
||||
line: "#9-:-Xlog:gc*,gc+age=trace,safepoint:file=/opt/my-app/gc.log:utctime,pid,tags:filecount=32,filesize=64m"
|
||||
|
@ -130,7 +130,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure cluster members
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "discovery.zen.ping.unicast.hosts: {{ elasticsearch_cluster_members }}"
|
||||
regexp: "^discovery.zen.ping.unicast.hosts:"
|
||||
|
@ -140,7 +140,7 @@
|
|||
- config
|
||||
|
||||
- name: Configure minimum master nodes
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "discovery.zen.minimum_master_nodes: {{ elasticsearch_minimum_master_nodes }}"
|
||||
regexp: "^discovery.zen.minimum_master_nodes:"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
|
||||
- name: Use the correct debian repository
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
curator_debian_repository: '{% if ansible_distribution_release == "jessie" %}debian{% else %}debian9{% endif %}'
|
||||
|
||||
- name: Curator sources list is available
|
||||
apt_repository:
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb https://packages.elastic.co/curator/5/{{ curator_debian_repository }} stable main"
|
||||
filename: curator
|
||||
update_cache: yes
|
||||
|
@ -15,7 +15,7 @@
|
|||
- packages
|
||||
|
||||
- name: Curator package is installed
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: elasticsearch-curator
|
||||
state: present
|
||||
tags:
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
- name: Set real datadir value when customized
|
||||
block:
|
||||
- name: "Is custom datadir present ?"
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ elasticsearch_custom_datadir }}"
|
||||
register: elasticsearch_custom_datadir_test
|
||||
check_mode: no
|
||||
|
||||
- name: "read the real datadir"
|
||||
command: readlink -f /var/lib/elasticsearch
|
||||
ansible.builtin.command: readlink -f /var/lib/elasticsearch
|
||||
changed_when: False
|
||||
register: elasticsearch_current_real_datadir_test
|
||||
check_mode: no
|
||||
|
@ -22,23 +22,24 @@
|
|||
- name: Datadir is moved to custom path
|
||||
block:
|
||||
- name: elasticsearch is stopped
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: elasticsearch
|
||||
state: stopped
|
||||
|
||||
- name: Move elasticsearch datadir to custom datadir
|
||||
command: mv {{ elasticsearch_current_real_datadir_test.stdout }} {{ elasticsearch_custom_datadir }}
|
||||
ansible.builtin.command:
|
||||
cmd: mv {{ elasticsearch_current_real_datadir_test.stdout }} {{ elasticsearch_custom_datadir }}
|
||||
args:
|
||||
creates: "{{ elasticsearch_custom_datadir }}"
|
||||
|
||||
- name: Symlink {{ elasticsearch_custom_datadir }} to /var/lib/elasticsearch
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
src: "{{ elasticsearch_custom_datadir }}"
|
||||
dest: '/var/lib/elasticsearch'
|
||||
state: link
|
||||
|
||||
- name: elasticsearch is started
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: elasticsearch
|
||||
state: started
|
||||
tags:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
|
||||
- name: Check if cron is installed
|
||||
shell: "set -o pipefail && dpkg -l cron 2>/dev/null | grep -q -E '^(i|h)i'"
|
||||
args:
|
||||
ansible.builtin.shell:
|
||||
cmd: "set -o pipefail && dpkg -l cron 2>/dev/null | grep -q -E '^(i|h)i'"
|
||||
executable: /bin/bash
|
||||
check_mode: no
|
||||
failed_when: False
|
||||
|
@ -10,7 +10,7 @@
|
|||
register: is_cron_installed
|
||||
|
||||
- name: "log rotation script"
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: rotate_elasticsearch_logs.j2
|
||||
dest: /etc/cron.daily/rotate_elasticsearch_logs
|
||||
owner: root
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
---
|
||||
|
||||
- include: packages.yml
|
||||
- ansible.builtin.include: packages.yml
|
||||
|
||||
- include: configuration.yml
|
||||
- ansible.builtin.include: configuration.yml
|
||||
|
||||
- include: bootstrap_checks.yml
|
||||
- ansible.builtin.include: bootstrap_checks.yml
|
||||
|
||||
- include: tmpdir.yml
|
||||
- ansible.builtin.include: tmpdir.yml
|
||||
|
||||
- include: datadir.yml
|
||||
- ansible.builtin.include: datadir.yml
|
||||
|
||||
- include: logs.yml
|
||||
- ansible.builtin.include: logs.yml
|
||||
|
||||
- include: additional_scripts.yml
|
||||
- ansible.builtin.include: additional_scripts.yml
|
||||
|
||||
- include: plugin_head.yml
|
||||
- ansible.builtin.include: plugin_head.yml
|
||||
when: elasticsearch_plugin_head | bool
|
||||
|
||||
- include: curator.yml
|
||||
- ansible.builtin.include: curator.yml
|
||||
when: elasticsearch_curator | bool
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: "User {{ elasticsearch_plugin_head_owner }} is present"
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: "{{ elasticsearch_plugin_head_owner }}"
|
||||
home: "{{ elasticsearch_plugin_head_home }}"
|
||||
createhome: yes
|
||||
|
@ -11,7 +11,7 @@
|
|||
- name: Head plugin is installed
|
||||
block:
|
||||
- name: Head repository is checked-out
|
||||
git:
|
||||
ansible.builtin.git:
|
||||
repo: "https://github.com/mobz/elasticsearch-head.git"
|
||||
dest: "{{ elasticsearch_plugin_head_clone_dir }}"
|
||||
clone: yes
|
||||
|
@ -19,12 +19,12 @@
|
|||
- packages
|
||||
|
||||
- name: Create tmpdir
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: "{{ elasticsearch_plugin_head_tmp_dir }}"
|
||||
state: directory
|
||||
|
||||
- name: NPM packages for head are installed
|
||||
npm:
|
||||
community.general.npm:
|
||||
path: "{{ elasticsearch_plugin_head_clone_dir }}"
|
||||
tags:
|
||||
- packages
|
||||
|
@ -35,7 +35,7 @@
|
|||
become: yes
|
||||
|
||||
- name: Elasticsearch HTTP/CORS are enabled
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "http.cors.enabled: true"
|
||||
regexp: "^http.cors.enabled:"
|
||||
|
@ -46,7 +46,7 @@
|
|||
- elasticsearch
|
||||
|
||||
- name: Elasticsearch HTTP/CORS accepts all origins
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
line: "http.cors.allow-origin: \"*\""
|
||||
regexp: "^http.cors.allow-origin:"
|
||||
|
@ -57,7 +57,7 @@
|
|||
- elasticsearch
|
||||
|
||||
- name: Install systemd unit
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: elasticsearch-head.service.j2
|
||||
dest: /etc/systemd/system/elasticsearch-head.service
|
||||
tags:
|
||||
|
@ -65,7 +65,7 @@
|
|||
- systemd
|
||||
|
||||
- name: Enable systemd unit
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: elasticsearch-head
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
|
||||
- name: Check if /tmp is noexec
|
||||
shell: "cat /etc/fstab | grep -E \" +/tmp\" | grep noexec"
|
||||
ansible.builtin.shell:
|
||||
cmd: "cat /etc/fstab | grep -E \" +/tmp\" | grep noexec"
|
||||
register: fstab_tmp_noexec
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
|
@ -9,13 +10,13 @@
|
|||
|
||||
- name: Tmpdir is moved to custom path
|
||||
block:
|
||||
- set_fact:
|
||||
- ansible.builtin.set_fact:
|
||||
_elasticsearch_custom_tmpdir: "{{ elasticsearch_custom_tmpdir | default(elasticsearch_default_tmpdir, True) | mandatory }}"
|
||||
tags:
|
||||
- elasticsearch
|
||||
|
||||
- name: "Create {{ _elasticsearch_custom_tmpdir }}"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ _elasticsearch_custom_tmpdir }}"
|
||||
owner: elasticsearch
|
||||
group: elasticsearch
|
||||
|
@ -25,7 +26,7 @@
|
|||
- elasticsearch
|
||||
|
||||
- name: change JVM tmpdir (< 6.x)
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/jvm.options.d/evolinux.options
|
||||
line: "-Djava.io.tmpdir={{ _elasticsearch_custom_tmpdir }}"
|
||||
regexp: "^-Djava.io.tmpdir="
|
||||
|
@ -40,7 +41,7 @@
|
|||
when: elastic_stack_version is version('6', '<')
|
||||
|
||||
- name: check if ES_TMPDIR is available (>= 6.x)
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/default/elasticsearch
|
||||
line: "ES_TMPDIR={{ _elasticsearch_custom_tmpdir }}"
|
||||
regexp: "^ES_TMPDIR="
|
||||
|
@ -53,7 +54,7 @@
|
|||
|
||||
# Note : Should not do any changes as -Djava.io.tmpdir=${ES_TMPDIR} is already here in the default config.
|
||||
- name: change JVM tmpdir (>= 6.x)
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/elasticsearch/jvm.options
|
||||
line: "-Djava.io.tmpdir=${ES_TMPDIR}"
|
||||
regexp: "^-Djava.io.tmpdir="
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
|
||||
- name: "Execute ansible-commit"
|
||||
command: "/usr/local/bin/ansible-commit --verbose --message \"{{ commit_message | mandatory }}\""
|
||||
ansible.builtin.command:
|
||||
cmd: "/usr/local/bin/ansible-commit --verbose --message \"{{ commit_message | mandatory }}\""
|
||||
changed_when:
|
||||
- _ansible_commit.stdout
|
||||
- "'CHANGED:' in _ansible_commit.stdout"
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
- name: "Assert that we have been called with `container` defined"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- container is defined
|
||||
|
||||
- name: "Define path to /etc in {{ container }} container"
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
container_etc: "{{ ('/var/lib/lxc', container, 'rootfs/etc') | path_join }}"
|
||||
|
||||
- name: "Check if /etc is a git repository in {{ container }}"
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ (container_etc, '.git') | path_join }}"
|
||||
get_attributes: no
|
||||
get_checksum: no
|
||||
|
@ -17,7 +17,7 @@
|
|||
register: "container_etc_git"
|
||||
|
||||
- name: "Evocommit /etc of {{ container }}"
|
||||
command:
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/local/bin/evocommit
|
||||
- '--ansible'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Git is installed (Debian)
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: git
|
||||
state: present
|
||||
tags:
|
||||
|
@ -10,12 +10,12 @@
|
|||
- ansible_distribution == "Debian"
|
||||
|
||||
- name: Install and configure utilities
|
||||
include: utils.yml
|
||||
ansible.builtin.include: utils.yml
|
||||
tags:
|
||||
- etc-git
|
||||
|
||||
- name: Configure repositories
|
||||
include: repositories.yml
|
||||
ansible.builtin.include: repositories.yml
|
||||
tags:
|
||||
- etc-git
|
||||
when: etc_git_config_repositories | bool
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
|
||||
- include: repository.yml
|
||||
- ansible.builtin.include: repository.yml
|
||||
vars:
|
||||
repository_path: "/etc"
|
||||
gitignore_items:
|
||||
|
@ -15,18 +15,18 @@
|
|||
- etc-git
|
||||
|
||||
- name: verify /usr/share/scripts presence
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /usr/share/scripts
|
||||
register: _usr_share_scripts
|
||||
tags:
|
||||
- etc-git
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
when:
|
||||
- _usr_share_scripts.stat.isdir
|
||||
|
||||
- include: repository.yml
|
||||
- ansible.builtin.include: repository.yml
|
||||
vars:
|
||||
repository_path: "/usr/share/scripts"
|
||||
gitignore_items: []
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
---
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
when: repository_path is search("/usr")
|
||||
|
||||
- name: "{{ repository_path }} is versioned with git"
|
||||
command: "git init ."
|
||||
ansible.builtin.command:
|
||||
cmd: "git init ."
|
||||
args:
|
||||
chdir: "{{ repository_path }}"
|
||||
creates: "{{ repository_path }}/.git/"
|
||||
|
@ -14,7 +15,7 @@
|
|||
- etc-git
|
||||
|
||||
- name: Git user.email is configured
|
||||
git_config:
|
||||
community.general.git_config:
|
||||
name: user.email
|
||||
repo: "{{ repository_path }}"
|
||||
scope: local
|
||||
|
@ -23,7 +24,7 @@
|
|||
- etc-git
|
||||
|
||||
- name: "{{ repository_path }}/.git is restricted to root"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ repository_path }}/.git"
|
||||
owner: root
|
||||
mode: "0700"
|
||||
|
@ -32,7 +33,7 @@
|
|||
- etc-git
|
||||
|
||||
- name: "{{ repository_path }}/.gitignore is present"
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: gitignore
|
||||
dest: "{{ repository_path }}/.gitignore"
|
||||
owner: root
|
||||
|
@ -42,7 +43,7 @@
|
|||
- etc-git
|
||||
|
||||
- name: "Some entries MUST be in the {{ repository_path }}/.gitignore file"
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: "{{ repository_path }}/.gitignore"
|
||||
line: "{{ item }}"
|
||||
loop: "{{ gitignore_items | default([]) }}"
|
||||
|
@ -50,7 +51,8 @@
|
|||
- etc-git
|
||||
|
||||
- name: "does {{ repository_path }}/ have any commit?"
|
||||
command: "git log"
|
||||
ansible.builtin.command:
|
||||
cmd: "git log"
|
||||
args:
|
||||
chdir: "{{ repository_path }}"
|
||||
changed_when: False
|
||||
|
@ -61,7 +63,8 @@
|
|||
- etc-git
|
||||
|
||||
- name: initial commit is present?
|
||||
shell: "git add -A . && git commit -m \"Initial commit via Ansible\""
|
||||
ansible.builtin.shell:
|
||||
cmd: "git add -A . && git commit -m \"Initial commit via Ansible\""
|
||||
args:
|
||||
chdir: "{{ repository_path }}"
|
||||
register: git_commit
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
tags:
|
||||
- etc-git
|
||||
|
||||
- name: "evocommit script is installed"
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: evocommit
|
||||
dest: /usr/local/bin/evocommit
|
||||
mode: "0755"
|
||||
|
@ -15,7 +15,7 @@
|
|||
- etc-git
|
||||
|
||||
- name: "ansible-commit script is installed"
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: ansible-commit
|
||||
dest: /usr/local/bin/ansible-commit
|
||||
mode: "0755"
|
||||
|
@ -24,7 +24,7 @@
|
|||
- etc-git
|
||||
|
||||
- name: "etc-git-optimize script is installed"
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: etc-git-optimize
|
||||
dest: /usr/share/scripts/etc-git-optimize
|
||||
mode: "0755"
|
||||
|
@ -33,7 +33,7 @@
|
|||
- etc-git
|
||||
|
||||
- name: "etc-git-status script is installed"
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: etc-git-status
|
||||
dest: /usr/share/scripts/etc-git-status
|
||||
mode: "0755"
|
||||
|
@ -42,8 +42,8 @@
|
|||
- etc-git
|
||||
|
||||
- name: Check if cron is installed
|
||||
shell: "set -o pipefail && dpkg -l cron 2>/dev/null | grep -q -E '^(i|h)i'"
|
||||
args:
|
||||
ansible.builtin.shell:
|
||||
cmd: "set -o pipefail && dpkg -l cron 2>/dev/null | grep -q -E '^(i|h)i'"
|
||||
executable: /bin/bash
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
|
@ -52,7 +52,7 @@
|
|||
|
||||
- block:
|
||||
- name: Legacy cron jobs for /etc/.git status are absent
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: "{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
|
@ -60,7 +60,7 @@
|
|||
- /etc/cron.d/etc-git-status
|
||||
|
||||
- name: Cron job for monthly git optimization
|
||||
cron:
|
||||
ansible.builtin.cron:
|
||||
name: "Monthly optimization"
|
||||
cron_file: etc-git
|
||||
special_time: "monthly"
|
||||
|
@ -68,7 +68,7 @@
|
|||
job: "/usr/share/scripts/etc-git-optimize"
|
||||
|
||||
- name: Cron job for hourly git status
|
||||
cron:
|
||||
ansible.builtin.cron:
|
||||
name: "Hourly warning for unclean Git repository if nobody is connected"
|
||||
cron_file: etc-git
|
||||
special_time: "hourly"
|
||||
|
@ -77,7 +77,7 @@
|
|||
state: "{{ etc_git_monitor_status | bool | ternary('present','absent') }}"
|
||||
|
||||
- name: Cron job for daily git status
|
||||
cron:
|
||||
ansible.builtin.cron:
|
||||
name: "Daily warning for unclean Git repository"
|
||||
cron_file: etc-git
|
||||
user: root
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
- name: newaliases
|
||||
command: newaliases
|
||||
ansible.builtin.command:
|
||||
cmd: newaliases
|
||||
|
||||
- name: Test Apache conf
|
||||
command: apache2ctl -t
|
||||
ansible.builtin.command:
|
||||
cmd: apache2ctl -t
|
||||
notify: "Reload Apache conf"
|
||||
|
||||
- name: reload apache2
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: apache2
|
||||
state: reloaded
|
||||
|
||||
- name: apt update
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: reload squid3
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: squid3
|
||||
state: reloaded
|
||||
|
||||
- name: reload squid
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: squid
|
||||
state: reloaded
|
||||
|
|
|
@ -1,27 +1,29 @@
|
|||
---
|
||||
- name: Do no install certbot crontab
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
certbot_custom_crontab: False
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/certbot
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
|
||||
|
||||
- name: Disable /etc/cron.d/certbot
|
||||
command: mv -f /etc/cron.d/certbot /etc/cron.d/certbot.disabled
|
||||
ansible.builtin.command:
|
||||
cmd: mv -f /etc/cron.d/certbot /etc/cron.d/certbot.disabled
|
||||
args:
|
||||
removes: /etc/cron.d/certbot
|
||||
|
||||
- name: Disable /etc/cron.daily/certbot
|
||||
command: mv -f /etc/cron.daily/certbot /etc/cron.daily/certbot.disabled
|
||||
ansible.builtin.command:
|
||||
cmd: mv -f /etc/cron.daily/certbot /etc/cron.daily/certbot.disabled
|
||||
args:
|
||||
removes: /etc/cron.daily/certbot
|
||||
|
||||
- name: Install evoacme custom cron
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: evoacme.cron
|
||||
dest: /etc/cron.daily/evoacme
|
||||
mode: "0755"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- ini_file:
|
||||
- community.general.ini_file:
|
||||
dest: "{{ evoacme_crt_dir }}/openssl.cnf"
|
||||
section: 'req'
|
||||
option: "{{ item.name }}"
|
||||
|
@ -11,7 +11,7 @@
|
|||
- { name: 'prompt', var: 'no' }
|
||||
|
||||
- name: Update openssl conf
|
||||
ini_file:
|
||||
community.general.ini_file:
|
||||
dest: "{{ evoacme_crt_dir }}/openssl.cnf"
|
||||
section: 'req_dn'
|
||||
option: "{{ item.name }}"
|
||||
|
@ -25,7 +25,7 @@
|
|||
- { name: 'emailAddress', var: "{{ evoacme_ssl_email }}" }
|
||||
|
||||
- name: Copy new evoacme conf
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: templates/evoacme.conf.j2
|
||||
dest: /etc/default/evoacme
|
||||
owner: root
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
---
|
||||
|
||||
- name: "Create {{ hook_name }} hook directory"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: "{{ evoacme_hooks_dir }}"
|
||||
state: directory
|
||||
|
||||
- name: "Search for {{ hook_name }} hook"
|
||||
command: "find {{ evoacme_hooks_dir }} -type f \\( -name '{{ hook_name }}' -o -name '{{ hook_name }}.*' \\)"
|
||||
ansible.builtin.command:
|
||||
cmd: "find {{ evoacme_hooks_dir }} -type f \\( -name '{{ hook_name }}' -o -name '{{ hook_name }}.*' \\)"
|
||||
check_mode: no
|
||||
changed_when: False
|
||||
register: _find_hook
|
||||
|
||||
- name: "Copy {{ hook_name }} hook if missing"
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "hooks/{{ hook_name }}"
|
||||
dest: "{{ evoacme_hooks_dir }}/{{ hook_name }}"
|
||||
mode: "0750"
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
---
|
||||
|
||||
- name: Verify Debian version
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version is version('9', '>=')
|
||||
msg: only compatible with Debian >= 9
|
||||
when: not (evoacme_disable_debian_check | bool)
|
||||
|
||||
- include: certbot.yml
|
||||
- ansible.builtin.include: certbot.yml
|
||||
|
||||
- include: permissions.yml
|
||||
- ansible.builtin.include: permissions.yml
|
||||
|
||||
# Enable this task if you want to deploy hooks
|
||||
# - include: evoacme_hook.yml
|
||||
|
@ -18,6 +18,6 @@
|
|||
# hook_name: "{{ item }}"
|
||||
# loop: []
|
||||
|
||||
- include: conf.yml
|
||||
- ansible.builtin.include: conf.yml
|
||||
|
||||
- include: scripts.yml
|
||||
- ansible.builtin.include: scripts.yml
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Fix crt directory permissions
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ evoacme_crt_dir }}"
|
||||
mode: "0755"
|
||||
owner: root
|
||||
|
@ -9,7 +9,7 @@
|
|||
state: directory
|
||||
|
||||
- name: "Fix hooks directory permissions"
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ evoacme_hooks_dir }}"
|
||||
mode: "0700"
|
||||
owner: root
|
||||
|
@ -17,7 +17,7 @@
|
|||
state: directory
|
||||
|
||||
- name: Fix log directory permissions
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ evoacme_log_dir }}"
|
||||
mode: "0755"
|
||||
owner: root
|
||||
|
@ -25,7 +25,7 @@
|
|||
state: directory
|
||||
|
||||
- name: Fix challenge directory permissions
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ evoacme_acme_dir }}"
|
||||
mode: "0755"
|
||||
owner: root
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
|
||||
- name: Create CSR dir
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ evoacme_csr_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
|
@ -12,7 +12,7 @@
|
|||
mode: "0755"
|
||||
|
||||
- name: Copy make-csr.sh script
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: make-csr.sh
|
||||
dest: /usr/local/sbin/make-csr
|
||||
owner: root
|
||||
|
@ -20,7 +20,7 @@
|
|||
mode: "0755"
|
||||
|
||||
- name: Copy vhost-domains.sh script
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: vhost-domains.sh
|
||||
dest: /usr/local/sbin/vhost-domains
|
||||
owner: root
|
||||
|
@ -28,7 +28,7 @@
|
|||
mode: "0755"
|
||||
|
||||
- name: Copy evoacme script
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: evoacme.sh
|
||||
dest: /usr/local/sbin/evoacme
|
||||
owner: root
|
||||
|
@ -36,7 +36,7 @@
|
|||
mode: "0755"
|
||||
|
||||
- name: Delete scripts in old location
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "/usr/local/bin/{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
---
|
||||
- name: restart minifirewall
|
||||
command: /etc/init.d/minifirewall restart
|
||||
ansible.builtin.command:
|
||||
cmd: /etc/init.d/minifirewall restart
|
||||
register: minifirewall_init_restart
|
||||
failed_when:
|
||||
- "'starting IPTables rules is now finish : OK' not in minifirewall_init_restart.stdout"
|
||||
- "'minifirewall started' not in minifirewall_init_restart.stdout"
|
||||
|
||||
- name: 'created new jail'
|
||||
command: "bkctld restart {{ evolinux_hostname }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "bkctld restart {{ evolinux_hostname }}"
|
||||
delegate_to: "{{ evobackup_client__hosts[0].ip }}"
|
||||
|
||||
- name: 'jail updated'
|
||||
command: "bkctld restart {{ evolinux_hostname }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "bkctld restart {{ evolinux_hostname }}"
|
||||
# - "bkctld sync {{ evolinux_hostname }}"
|
||||
delegate_to: "{{ evobackup_client__hosts[0].ip }}"
|
||||
when: evobackup_client__hosts | length > 1
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
|
||||
- name: 'create jail'
|
||||
command: "bkctld init {{ evolinux_hostname }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "bkctld init {{ evolinux_hostname }}"
|
||||
args:
|
||||
creates: "/backup/jails/{{ evolinux_hostname }}/"
|
||||
become: true
|
||||
|
@ -15,7 +16,8 @@
|
|||
# temp fix for bkctld 2.x because the ip and key command return 1
|
||||
# if the jail is not started, see https://gitea.evolix.org/evolix/evobackup/issues/31
|
||||
- name: 'start jail'
|
||||
command: "bkctld restart {{ evolinux_hostname }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "bkctld restart {{ evolinux_hostname }}"
|
||||
become: true
|
||||
delegate_to: "{{ evobackup_client__hosts[0].ip }}"
|
||||
tags:
|
||||
|
@ -23,7 +25,8 @@
|
|||
- evobackup_client_jail
|
||||
|
||||
- name: 'add ip to jail'
|
||||
command: "bkctld ip {{ evolinux_hostname }} {{ ansible_host }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "bkctld ip {{ evolinux_hostname }} {{ ansible_host }}"
|
||||
become: true
|
||||
delegate_to: "{{ evobackup_client__hosts[0].ip }}"
|
||||
notify: 'jail updated'
|
||||
|
@ -32,7 +35,8 @@
|
|||
- evobackup_client_jail
|
||||
|
||||
- name: 'add key to jail'
|
||||
command: "bkctld key {{ evolinux_hostname }} /root/{{ evolinux_hostname }}.pub"
|
||||
ansible.builtin.command:
|
||||
cmd: "bkctld key {{ evolinux_hostname }} /root/{{ evolinux_hostname }}.pub"
|
||||
become: true
|
||||
delegate_to: "{{ evobackup_client__hosts[0].ip }}"
|
||||
notify: 'jail updated'
|
||||
|
@ -41,7 +45,8 @@
|
|||
- evobackup_client_jail
|
||||
|
||||
- name: 'get jail port'
|
||||
command: "bkctld port {{ evolinux_hostname }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "bkctld port {{ evolinux_hostname }}"
|
||||
become: true
|
||||
register: bkctld_port
|
||||
delegate_to: "{{ evobackup_client__hosts[0].ip }}"
|
||||
|
@ -50,7 +55,7 @@
|
|||
- evobackup_client_jail
|
||||
|
||||
- name: 'register jail port'
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
evobackup_ssh_port={{ bkctld_port.stdout }}
|
||||
tags:
|
||||
- evobackup_client
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
---
|
||||
|
||||
- include: "ssh_key.yml"
|
||||
- ansible.builtin.include: "ssh_key.yml"
|
||||
tags:
|
||||
- evobackup_client
|
||||
- evobackup_client_backup_ssh_key
|
||||
|
||||
- include: "jail.yml"
|
||||
- ansible.builtin.include: "jail.yml"
|
||||
tags:
|
||||
- evobackup_client
|
||||
- evobackup_client_jail
|
||||
|
||||
- include: "upload_scripts.yml"
|
||||
- ansible.builtin.include: "upload_scripts.yml"
|
||||
tags:
|
||||
- evobackup_client
|
||||
- evobackup_client_backup_scripts
|
||||
|
||||
- include: "open_ssh_ports.yml"
|
||||
- ansible.builtin.include: "open_ssh_ports.yml"
|
||||
tags:
|
||||
- evobackup_client
|
||||
- evobackup_client_backup_firewall
|
||||
|
||||
- include: "verify_ssh.yml"
|
||||
- ansible.builtin.include: "verify_ssh.yml"
|
||||
tags:
|
||||
- evobackup_client
|
||||
- evobackup_client_backup_hosts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Is there a Minifirewall ?
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: /etc/default/minifirewall
|
||||
register: evobackup_client__minifirewall
|
||||
tags:
|
||||
|
@ -9,7 +9,7 @@
|
|||
- evobackup_client_backup_firewall
|
||||
|
||||
- name: Add backup SSH port in /etc/default/minifirewall
|
||||
blockinfile:
|
||||
ansible.builtin.blockinfile:
|
||||
dest: /etc/default/minifirewall
|
||||
marker: "# {mark} {{ item.name }}"
|
||||
block: |
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Create SSH key
|
||||
user:
|
||||
ansible.builtin.user:
|
||||
name: root
|
||||
generate_ssh_key: true
|
||||
ssh_key_file: "{{ evobackup_client__root_key_path }}"
|
||||
|
@ -12,7 +12,7 @@
|
|||
- evobackup_client_backup_ssh_key
|
||||
|
||||
- name: Print SSH key
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: evobackup_client__root_key.ssh_public_key
|
||||
when: evobackup_client__root_key.ssh_public_key is defined
|
||||
tags:
|
||||
|
@ -20,7 +20,7 @@
|
|||
- evobackup_client_backup_ssh_key
|
||||
|
||||
- name: 'copy ssh public key to backup server'
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
content: "{{ evobackup_client__root_key.ssh_public_key }}"
|
||||
dest: "/root/{{ evolinux_hostname }}.pub"
|
||||
become: true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Upload evobackup script
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ evobackup_client__cron_path }}"
|
||||
force: true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Verify evolix backup servers
|
||||
known_hosts:
|
||||
ansible.builtin.known_hosts:
|
||||
path: /root/.ssh/known_hosts
|
||||
name: "[{{ item.name }}]:{{ item.port }}"
|
||||
key: "[{{ item.name }}]:{{ item.port }} {{ item.fingerprint }}"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
|
||||
- name: Check if cron is installed
|
||||
shell: "set -o pipefail && dpkg -l cron 2>/dev/null | grep -q -E '^(i|h)i'"
|
||||
args:
|
||||
ansible.builtin.shell:
|
||||
cmd: "set -o pipefail && dpkg -l cron 2>/dev/null | grep -q -E '^(i|h)i'"
|
||||
executable: /bin/bash
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
|
@ -10,7 +10,7 @@
|
|||
register: is_cron_installed
|
||||
|
||||
- name: evocheck crontab is updated
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: crontab.j2
|
||||
dest: /etc/cron.d/evocheck
|
||||
mode: "0644"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
- name: run evocheck
|
||||
command: "{{ evocheck_bin_dir }}/evocheck.sh"
|
||||
ansible.builtin.command:
|
||||
cmd: "{{ evocheck_bin_dir }}/evocheck.sh"
|
||||
register: evocheck_run
|
||||
changed_when: False
|
||||
failed_when: False
|
||||
|
@ -8,7 +9,7 @@
|
|||
tags:
|
||||
- evocheck-exec
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: evocheck_run.stdout_lines
|
||||
when: evocheck_run.stdout | length > 0
|
||||
tags:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
when: evocheck_bin_dir is search("/usr")
|
||||
tags:
|
||||
- evocheck
|
||||
|
||||
- name: Scripts dir is present
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ evocheck_bin_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
|
@ -16,22 +16,22 @@
|
|||
- evocheck
|
||||
|
||||
- name: Script for Debian 7 and earlier
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
evocheck_script_src: evocheck.wheezy.sh
|
||||
when: ansible_distribution_major_version is version('7', '<=')
|
||||
|
||||
- name: Script for Debian 8
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
evocheck_script_src: evocheck.jessie.sh
|
||||
when: ansible_distribution_major_version is version('8', '=')
|
||||
|
||||
- name: Script for Debian 9 and later
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
evocheck_script_src: evocheck.sh
|
||||
when: ansible_distribution_major_version is version('9', '>=')
|
||||
|
||||
- name: Copy evocheck.sh
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "{{ evocheck_script_src }}"
|
||||
dest: "{{ evocheck_bin_dir }}/evocheck.sh"
|
||||
mode: "0700"
|
||||
|
@ -41,7 +41,7 @@
|
|||
- evocheck
|
||||
|
||||
- name: Copy evocheck.cf
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: evocheck.cf
|
||||
dest: /etc/evocheck.cf
|
||||
force: no
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
|
||||
- include: install.yml
|
||||
- ansible.builtin.include: install.yml
|
||||
|
||||
- include: cron.yml
|
||||
- ansible.builtin.include: cron.yml
|
||||
when: evocheck_update_crontab | bool
|
||||
|
|
|
@ -1,75 +1,81 @@
|
|||
---
|
||||
- name: dpkg-reconfigure-debconf
|
||||
command: dpkg-reconfigure --frontend noninteractive debconf
|
||||
ansible.builtin.command:
|
||||
cmd: dpkg-reconfigure --frontend noninteractive debconf
|
||||
|
||||
- name: dpkg-reconfigure-locales
|
||||
command: dpkg-reconfigure --frontend noninteractive locales
|
||||
ansible.builtin.command:
|
||||
cmd: dpkg-reconfigure --frontend noninteractive locales
|
||||
|
||||
- name: dpkg-reconfigure-apt
|
||||
command: dpkg-reconfigure --frontend noninteractive apt-listchanges
|
||||
ansible.builtin.command:
|
||||
cmd: dpkg-reconfigure --frontend noninteractive apt-listchanges
|
||||
|
||||
# - name: debconf-set-selections
|
||||
# command: debconf-set-selections /root/debconf-preseed
|
||||
|
||||
- name: apt update
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: restart rsyslog
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: rsyslog
|
||||
state: restarted
|
||||
|
||||
|
||||
- name: remount /home
|
||||
command: mount -o remount /home
|
||||
ansible.builtin.command:
|
||||
cmd: mount -o remount /home
|
||||
|
||||
- name: remount /var
|
||||
command: mount -o remount /var
|
||||
ansible.builtin.command:
|
||||
cmd: mount -o remount /var
|
||||
|
||||
|
||||
- name: restart nginx
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: nginx
|
||||
state: restarted
|
||||
|
||||
- name: reload nginx
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
|
||||
- name: restart apache
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: apache2
|
||||
state: restarted
|
||||
|
||||
- name: reload apache
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: apache2
|
||||
state: reloaded
|
||||
|
||||
- name: restart cron
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: cron
|
||||
state: restarted
|
||||
|
||||
- name: newaliases
|
||||
command: newaliases
|
||||
ansible.builtin.command:
|
||||
cmd: newaliases
|
||||
changed_when: False
|
||||
|
||||
|
||||
- name: reload sshd
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: ssh
|
||||
state: reloaded
|
||||
|
||||
- name: reload postfix
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: postfix
|
||||
state: reloaded
|
||||
|
||||
- name: restart log2mail
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: log2mail
|
||||
state: restarted
|
||||
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
# mode: "0700"
|
||||
# state: directory
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/evolinux-todo
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
# This is still incompatible with Debian
|
||||
|
||||
- name: Check if PERC HBA11 device is present
|
||||
ansible.builtin.shell: "lspci | grep -qE 'MegaRAID.*SAS39xx'"
|
||||
ansible.builtin.shell:
|
||||
cmd: "lspci | grep -qE 'MegaRAID.*SAS39xx'"
|
||||
check_mode: no
|
||||
register: perc_hba11_search
|
||||
failed_when: False
|
||||
|
@ -74,7 +75,7 @@
|
|||
when: ansible_distribution_major_version is version('12', '>=')
|
||||
|
||||
- name: Update APT cache
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
when: hwraid_sources is changed
|
||||
|
||||
|
|
|
@ -67,13 +67,13 @@
|
|||
- packages
|
||||
|
||||
- name: "HP"
|
||||
import_tasks: hardware.hp.yml
|
||||
ansible.builtin.import_tasks: hardware.hp.yml
|
||||
when:
|
||||
- "'Hewlett-Packard Company Smart Array' in raidmodel.stdout or 'Adaptec Smart Storage PQI' in raidmodel.stdout"
|
||||
- evolinux_packages_hardware_raid | bool
|
||||
|
||||
- name: "Dell"
|
||||
import_tasks: hardware.dell.yml
|
||||
ansible.builtin.import_tasks: hardware.dell.yml
|
||||
when:
|
||||
- "'MegaRAID' in raidmodel.stdout"
|
||||
- evolinux_packages_hardware_raid | bool
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
|
||||
- name: "System compatibility checks"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version is version('8', '>=')
|
||||
msg: only compatible with Debian >= 8
|
||||
|
||||
- name: Apt configuration
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/apt
|
||||
vars:
|
||||
apt_install_basics: "{{ evolinux_apt_replace_default_sources }}"
|
||||
|
@ -18,52 +18,52 @@
|
|||
when: evolinux_apt_include | bool
|
||||
|
||||
- name: /etc versioning with Git
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/etc-git
|
||||
when: evolinux_etcgit_include | bool
|
||||
|
||||
- name: /etc/evolinux base
|
||||
import_tasks: etc-evolinux.yml
|
||||
ansible.builtin.import_tasks: etc-evolinux.yml
|
||||
when: evolinux_etcevolinux_include | bool
|
||||
|
||||
- name: Hostname
|
||||
import_tasks: hostname.yml
|
||||
ansible.builtin.import_tasks: hostname.yml
|
||||
when: evolinux_hostname_include | bool
|
||||
|
||||
- name: Kernel tuning
|
||||
import_tasks: kernel.yml
|
||||
ansible.builtin.import_tasks: kernel.yml
|
||||
when: evolinux_kernel_include | bool
|
||||
|
||||
- name: Fstab configuration
|
||||
import_tasks: fstab.yml
|
||||
ansible.builtin.import_tasks: fstab.yml
|
||||
when: evolinux_fstab_include | bool
|
||||
|
||||
- name: Packages
|
||||
import_tasks: packages.yml
|
||||
ansible.builtin.import_tasks: packages.yml
|
||||
when: evolinux_packages_include | bool
|
||||
|
||||
- name: System settings
|
||||
import_tasks: system.yml
|
||||
ansible.builtin.import_tasks: system.yml
|
||||
when: evolinux_system_include | bool
|
||||
|
||||
- name: Minifirewall
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/minifirewall
|
||||
when: evolinux_minifirewall_include | bool
|
||||
|
||||
- name: Evomaintenance
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/evomaintenance
|
||||
when: evolinux_evomaintenance_include | bool
|
||||
|
||||
- name: SSH configuration (single file)
|
||||
import_tasks: ssh.single-file.yml
|
||||
ansible.builtin.import_tasks: ssh.single-file.yml
|
||||
when:
|
||||
- ansible_distribution_major_version is version('12', '<')
|
||||
- evolinux_ssh_include | bool
|
||||
|
||||
- name: SSH configuration (included-files)
|
||||
import_tasks: ssh.included-files.yml
|
||||
ansible.builtin.import_tasks: ssh.included-files.yml
|
||||
when:
|
||||
- ansible_distribution_major_version is version('12', '>=')
|
||||
- evolinux_ssh_include | bool
|
||||
|
@ -75,71 +75,71 @@
|
|||
# when: evolinux_users_include
|
||||
|
||||
- name: Root user configuration
|
||||
import_tasks: root.yml
|
||||
ansible.builtin.import_tasks: root.yml
|
||||
when: evolinux_root_include | bool
|
||||
|
||||
- name: Postfix
|
||||
import_tasks: postfix.yml
|
||||
ansible.builtin.import_tasks: postfix.yml
|
||||
when: evolinux_postfix_include | bool
|
||||
|
||||
- name: Logs management
|
||||
import_tasks: logs.yml
|
||||
ansible.builtin.import_tasks: logs.yml
|
||||
when: evolinux_logs_include | bool
|
||||
|
||||
- name: Default index page
|
||||
import_tasks: default_www.yml
|
||||
ansible.builtin.import_tasks: default_www.yml
|
||||
when: evolinux_default_www_include | bool
|
||||
|
||||
- name: Hardware drivers and tools
|
||||
import_tasks: hardware.yml
|
||||
ansible.builtin.import_tasks: hardware.yml
|
||||
when:
|
||||
- evolinux_hardware_include | bool
|
||||
- ansible_virtualization_role == "host"
|
||||
|
||||
- name: Customize for Online.net
|
||||
import_tasks: provider_online.yml
|
||||
ansible.builtin.import_tasks: provider_online.yml
|
||||
when: evolinux_provider_online_include | bool
|
||||
|
||||
- name: Customize for Orange FCE
|
||||
import_tasks: provider_orange_fce.yml
|
||||
ansible.builtin.import_tasks: provider_orange_fce.yml
|
||||
when: evolinux_provider_orange_fce_include | bool
|
||||
|
||||
- name: Override Log2mail service
|
||||
import_tasks: log2mail.yml
|
||||
ansible.builtin.import_tasks: log2mail.yml
|
||||
when: evolinux_log2mail_include | bool
|
||||
|
||||
- import_tasks: motd.yml
|
||||
- ansible.builtin.import_tasks: motd.yml
|
||||
when: evolinux_motd_include | bool
|
||||
|
||||
- import_tasks: utils.yml
|
||||
- ansible.builtin.import_tasks: utils.yml
|
||||
when: evolinux_utils_include | bool
|
||||
|
||||
- name: Munin
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/munin
|
||||
when: evolinux_munin_include | bool
|
||||
|
||||
- name: Nagios/NRPE
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/nagios-nrpe
|
||||
when: evolinux_nagios_nrpe_include | bool
|
||||
|
||||
- name: fail2ban
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/fail2ban
|
||||
when: evolinux_fail2ban_include | bool
|
||||
|
||||
- name: Evocheck
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/evocheck
|
||||
when: evolinux_evocheck_include | bool
|
||||
|
||||
- name: Listupgrade
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/listupgrade
|
||||
when: evolinux_listupgrade_include | bool
|
||||
|
||||
- name: Generate ldif script
|
||||
include_role:
|
||||
ansible.builtin.include_role:
|
||||
name: evolix/generate-ldif
|
||||
when: evolinux_generateldif_include | bool
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
# TODO : find a way to force the console-data configuration
|
||||
# non-interactively (like tzdata ↑)
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
|
||||
- name: Ensure automagic vim conf is disabled
|
||||
|
@ -129,7 +129,7 @@
|
|||
- is_cron_installed.rc == 0
|
||||
- evolinux_system_cron_random | bool
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/ntpd
|
||||
|
||||
## alert5
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
|
||||
- include_role:
|
||||
- ansible.builtin.include_role:
|
||||
name: evolix/remount-usr
|
||||
|
||||
- include_tasks:
|
||||
- ansible.builtin.include_tasks:
|
||||
file: dump-server-state.yml
|
||||
|
||||
- name: "/sbin/deny script is present"
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
---
|
||||
|
||||
- name: cat /etc/evolinux/todo.txt
|
||||
command: "cat /etc/evolinux/todo.txt"
|
||||
ansible.builtin.command:
|
||||
cmd: "cat /etc/evolinux/todo.txt"
|
||||
register: evolinux_todo
|
||||
changed_when: False
|
||||
failed_when: False
|
||||
check_mode: no
|
||||
|
||||
- name: "Content of /etc/evolinux/todo.txt"
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: evolinux_todo.stdout_lines
|
||||
when: evolinux_todo.stdout | length > 0
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
|
||||
- name: /etc/evolinux is present
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
dest: /etc/evolinux
|
||||
mode: "0700"
|
||||
state: directory
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
- name: /etc/evolinux/todo.txt is present
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: todo.defaults.txt
|
||||
dest: /etc/evolinux/todo.txt
|
||||
mode: "0640"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
---
|
||||
- name: reload sshd
|
||||
service:
|
||||
ansible.builtin.service:
|
||||
name: sshd
|
||||
state: reloaded
|
||||
|
||||
- name: newaliases
|
||||
command: newaliases
|
||||
ansible.builtin.command:
|
||||
cmd: newaliases
|
||||
changed_when: False
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
|
||||
- name: "System compatibility checks"
|
||||
assert:
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version is version('8', '>=')
|
||||
msg: only compatible with Debian >= 8
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "Warning: empty 'evolinux_users' variable, tasks will be skipped!"
|
||||
when: evolinux_users | length == 0
|
||||
|
||||
- name: Create user accounts
|
||||
include: user.yml
|
||||
ansible.builtin.include: user.yml
|
||||
vars:
|
||||
user: "{{ item.value }}"
|
||||
loop: "{{ evolinux_users | dict2items }}"
|
||||
|
@ -21,8 +21,8 @@
|
|||
- evolinux_users | length > 0
|
||||
|
||||
- name: Configure sudo
|
||||
include: sudo.yml
|
||||
ansible.builtin.include: sudo.yml
|
||||
|
||||
- name: Configure SSH
|
||||
include: ssh.yml
|
||||
ansible.builtin.include: ssh.yml
|
||||
when: evolinux_users | length > 0
|
||||
|
|
|
@ -1,51 +1,53 @@
|
|||
---
|
||||
|
||||
- name: verify AllowGroups directive
|
||||
command: "grep -E '^AllowGroups' /etc/ssh/sshd_config"
|
||||
ansible.builtin.command:
|
||||
cmd: "grep -E '^AllowGroups' /etc/ssh/sshd_config"
|
||||
changed_when: False
|
||||
failed_when: False
|
||||
check_mode: no
|
||||
register: grep_allowgroups_ssh
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: grep_allowgroups_ssh
|
||||
verbosity: 1
|
||||
|
||||
- name: verify AllowUsers directive
|
||||
command: "grep -E '^AllowUsers' /etc/ssh/sshd_config"
|
||||
ansible.builtin.command:
|
||||
cmd: "grep -E '^AllowUsers' /etc/ssh/sshd_config"
|
||||
changed_when: False
|
||||
failed_when: False
|
||||
check_mode: no
|
||||
register: grep_allowusers_ssh
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: grep_allowusers_ssh
|
||||
verbosity: 1
|
||||
|
||||
- assert:
|
||||
- ansible.builtin.assert:
|
||||
that: "not (grep_allowusers_ssh.rc == 0 and grep_allowgroups_ssh.rc == 0)"
|
||||
msg: "We can't deal with AllowUsers and AllowGroups at the same time"
|
||||
|
||||
- set_fact:
|
||||
- ansible.builtin.set_fact:
|
||||
# If "AllowGroups is present" or "AllowUsers is absent and Debian 10+",
|
||||
ssh_allowgroups: "{{ (grep_allowgroups_ssh.rc == 0) or (grep_allowusers_ssh.rc != 0 and (ansible_distribution_major_version is version('10', '>='))) }}"
|
||||
# If "AllowGroups is absent" and "AllowUsers is absent or Debian <10"
|
||||
ssh_allowusers: "{{ (grep_allowusers_ssh.rc == 0) or (grep_allowgroups_ssh.rc != 0 and (ansible_distribution_major_version is version('10', '<'))) }}"
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: ssh_allowgroups
|
||||
verbosity: 1
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: ssh_allowusers
|
||||
verbosity: 1
|
||||
|
||||
- include: ssh_allowgroups.yml
|
||||
- ansible.builtin.include: ssh_allowgroups.yml
|
||||
when:
|
||||
- ssh_allowgroups
|
||||
- not ssh_allowusers
|
||||
|
||||
- include: ssh_allowusers.yml
|
||||
- ansible.builtin.include: ssh_allowusers.yml
|
||||
vars:
|
||||
user: "{{ item.value }}"
|
||||
loop: "{{ evolinux_users | dict2items }}"
|
||||
|
@ -55,11 +57,11 @@
|
|||
- not ssh_allowgroups
|
||||
|
||||
- name: disable root login
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/ssh/sshd_config
|
||||
regexp: '^#PermitRootLogin (yes|without-password|prohibit-password)'
|
||||
replace: "PermitRootLogin no"
|
||||
notify: reload sshd
|
||||
when: evolinux_root_disable_ssh | bool
|
||||
|
||||
- meta: flush_handlers
|
||||
- ansible.builtin.meta: flush_handlers
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
# this check must be repeated for each user
|
||||
# even if it's been done before
|
||||
- name: verify AllowGroups directive
|
||||
command: "grep -E '^AllowGroups' /etc/ssh/sshd_config"
|
||||
ansible.builtin.command:
|
||||
cmd: "grep -E '^AllowGroups' /etc/ssh/sshd_config"
|
||||
changed_when: False
|
||||
failed_when: False
|
||||
check_mode: no
|
||||
register: grep_allowgroups_ssh
|
||||
|
||||
- name: "Add AllowGroups sshd directive with '{{ evolinux_ssh_group }}'"
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
line: "\nAllowGroups {{ evolinux_ssh_group }}"
|
||||
insertafter: 'Subsystem'
|
||||
|
@ -19,7 +20,7 @@
|
|||
when: grep_allowgroups_ssh.rc != 0
|
||||
|
||||
- name: "Append '{{ evolinux_ssh_group }}' to AllowGroups sshd directive"
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/ssh/sshd_config
|
||||
regexp: '^(AllowGroups ((?!\b{{ evolinux_ssh_group }}\b).)*)$'
|
||||
replace: '\1 {{ evolinux_ssh_group }}'
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
# this check must be repeated for each user
|
||||
# even if it's been done before
|
||||
- name: verify AllowUsers directive
|
||||
command: "grep -E '^AllowUsers' /etc/ssh/sshd_config"
|
||||
ansible.builtin.command:
|
||||
cmd: "grep -E '^AllowUsers' /etc/ssh/sshd_config"
|
||||
changed_when: False
|
||||
failed_when: False
|
||||
check_mode: no
|
||||
register: grep_allowusers_ssh
|
||||
|
||||
- name: "Add AllowUsers sshd directive with '{{ user.name }}'"
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
line: "\nAllowUsers {{ user.name }}"
|
||||
insertafter: 'Subsystem'
|
||||
|
@ -19,7 +20,7 @@
|
|||
when: grep_allowusers_ssh.rc != 0
|
||||
|
||||
- name: "Append '{{ user.name }}' to AllowUsers sshd directive"
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/ssh/sshd_config
|
||||
regexp: '^(AllowUsers ((?!\b{{ user.name }}\b).)*)$'
|
||||
replace: '\1 {{ user.name }}'
|
||||
|
@ -28,14 +29,15 @@
|
|||
when: grep_allowusers_ssh.rc == 0
|
||||
|
||||
- name: "verify Match User directive"
|
||||
command: "grep -E '^Match User' /etc/ssh/sshd_config"
|
||||
ansible.builtin.command:
|
||||
cmd: "grep -E '^Match User' /etc/ssh/sshd_config"
|
||||
changed_when: False
|
||||
failed_when: False
|
||||
check_mode: no
|
||||
register: grep_matchuser_ssh
|
||||
|
||||
- name: "Add Match User sshd directive with '{{ user.name }}'"
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
line: "\nMatch User {{ user.name }}\n PasswordAuthentication no"
|
||||
insertafter: "# END EVOLINUX PASSWORD RESTRICTIONS BY ADDRESS"
|
||||
|
@ -44,7 +46,7 @@
|
|||
when: grep_matchuser_ssh.rc != 0
|
||||
|
||||
- name: "Append '{{ user.name }}' to Match User's sshd directive"
|
||||
replace:
|
||||
ansible.builtin.replace:
|
||||
dest: /etc/ssh/sshd_config
|
||||
regexp: '^(Match User ((?!{{ user.name }}).)*)$'
|
||||
replace: '\1,{{ user.name }}'
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue