From d8385bff84186afe66e6fb5842b728a3337c225e Mon Sep 17 00:00:00 2001 From: Patrick Marchand Date: Mon, 6 May 2019 22:00:45 +0200 Subject: [PATCH 1/4] Make it possible to overwrite the default evoadmin-web templates The templates can also be forced to update if so desired. --- CHANGELOG.md | 1 + webapps/evoadmin-web/README.md | 35 ++++++++++++++++++++++++++ webapps/evoadmin-web/defaults/main.yml | 5 ++++ webapps/evoadmin-web/tasks/config.yml | 18 +++++++++++-- webapps/evoadmin-web/tasks/user.yml | 9 ++++++- webapps/evoadmin-web/tasks/web.yml | 19 +++++++++++--- 6 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 webapps/evoadmin-web/README.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 73e9f2e0..8642c3bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The **patch** part changes incrementally at each release. ### Added * apache: add server status suffix in VHost (and default site) if missing * nginx: add server status suffix in VHost (and default site) if missing +* Overload evoadmin-web templates if needed ### Changed * evocheck : version 19.04 from upstream diff --git a/webapps/evoadmin-web/README.md b/webapps/evoadmin-web/README.md new file mode 100644 index 00000000..918e8004 --- /dev/null +++ b/webapps/evoadmin-web/README.md @@ -0,0 +1,35 @@ +# Set custom web-add.conf file +- "templates/evoadmin-web/web-add.{{ inventory_hostname }}.conf.j2" +- "templates/evoadmin-web/web-add.{{ host_group }}.conf.j2" +- "templates/evoadmin-web/web-add.conf.j2" +And force it to update: + web_add_conf_force: True + +# Set custom web-mail.tpl +- "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2" +- "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2" +- "templates/evoadmin-web/web-mail.tpl.j2" +And force it to update: + web_mail_tpl_force: True + +# Set custom evoadmin.conf VHost +- "templates/evoadmin-web/evoadmin.{{ inventory_hostname }}.conf.j2" +- "templates/evoadmin-web/evoadmin.{{ host_group }}.conf.j2" +- "templates/evoadmin-web/evoadmin.conf.j2" +And force it to update: + evoadmin_web_conf_force: True + +# Set custom config.local.php +- "templates/evoadmin-web/config.local.{{ inventory_hostname }}.conf.j2" +- "templates/evoadmin-web/config.local.{{ host_group }}.conf.j2" +- "templates/evoadmin-web/config.local.conf.j2" +And force it to update: + evoadmin_web_config_local_php_force: True + +# Set evoadmin-web sudoers file +- "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2" +- "templates/evoadmin-web/sudoers.{{ host_group }}.j2" +- "templates/evoadmin-web/sudoers.j2" +- "sudoers.j2" +And force it to update: + evoadmin_web_sudoers_conf_force: True \ No newline at end of file diff --git a/webapps/evoadmin-web/defaults/main.yml b/webapps/evoadmin-web/defaults/main.yml index c57c3b54..fc77c234 100644 --- a/webapps/evoadmin-web/defaults/main.yml +++ b/webapps/evoadmin-web/defaults/main.yml @@ -11,6 +11,11 @@ evoadmin_host: "evoadmin.{{ ansible_fqdn }}" evoadmin_username: evoadmin evoadmin_enable_vhost: True +evoadmin_force_vhost: False +evoadmin_web_config_local_php_force: False +evoadmin_web_sudoers_conf_force: False +web_add_conf_force: False +web_mail_tpl_force: False evoadmin_tpl_servername: "{{ ansible_fqdn }}" evoadmin_tpl_address: "{{ ansible_default_ipv4.address }}" diff --git a/webapps/evoadmin-web/tasks/config.yml b/webapps/evoadmin-web/tasks/config.yml index b34b5ef0..b36f8178 100644 --- a/webapps/evoadmin-web/tasks/config.yml +++ b/webapps/evoadmin-web/tasks/config.yml @@ -8,10 +8,24 @@ - name: Configure web-add config file template: - src: web-add.conf.j2 + src: "{{ item }}" dest: /etc/evolinux/web-add.conf + force: "{{ web_add_conf_force | bool }}" + with_first_found: + - "templates/evoadmin-web/web-add.{{ inventory_hostname }}.conf.j2" + - "templates/evoadmin-web/web-add.{{ host_group }}.conf.j2" + - "templates/evoadmin-web/web-add.conf.j2" + - "web-add.conf.j2" + register: web_add_conf_template - name: Configure web-add template file for mail template: - src: web-mail.tpl.j2 + src: "{{ item }}" dest: "{{ evoadmin_scripts_dir }}/web-mail.tpl" + force: "{{ web_mail_tpl_force | bool }}" + with_first_found: + - "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2" + - "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2" + - "templates/evoadmin-web/web-mail.tpl.j2" + - "web-mail.default.tpl.j2" + register: web_mail_tpl_template \ No newline at end of file diff --git a/webapps/evoadmin-web/tasks/user.yml b/webapps/evoadmin-web/tasks/user.yml index 947b3cd0..08a952a2 100644 --- a/webapps/evoadmin-web/tasks/user.yml +++ b/webapps/evoadmin-web/tasks/user.yml @@ -103,7 +103,14 @@ - name: Add evoadmin sudoers file template: - src: sudoers.j2 + src: "{{ item }}" dest: /etc/sudoers.d/evoadmin mode: "0600" + force: "{{ evoadmin_web_sudoers_conf_force | bool }}" validate: "visudo -cf %s" + with_first_found: + - "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2" + - "templates/evoadmin-web/sudoers.{{ host_group }}.j2" + - "templates/evoadmin-web/sudoers.j2" + - "sudoers.j2" + register: evoadmin_web_sudoers_conf \ No newline at end of file diff --git a/webapps/evoadmin-web/tasks/web.yml b/webapps/evoadmin-web/tasks/web.yml index d8405f8f..12ad23b6 100644 --- a/webapps/evoadmin-web/tasks/web.yml +++ b/webapps/evoadmin-web/tasks/web.yml @@ -20,8 +20,15 @@ - name: Install evoadmin VHost template: - src: evoadmin.conf.j2 + src: "{{ item }}" dest: /etc/apache2/sites-available/evoadmin.conf + force: "{{ evoadmin_force_vhost | bool }}" + with_first_found: + - "templates/evoadmin-web/evoadmin.{{ inventory_hostname }}.conf.j2" + - "templates/evoadmin-web/evoadmin.{{ host_group }}.conf.j2" + - "templates/evoadmin-web/evoadmin.conf.j2" + - "evoadmin.conf.j2" + register: evoadmin_vhost_template notify: reload apache2 - name: Enable evoadmin vhost @@ -40,9 +47,15 @@ - name: Copy config file for evoadmin template: - src: config.local.php.j2 + src: "{{ item }}" dest: "{{ evoadmin_document_root}}/conf/config.local.php" mode: "0640" owner: evoadmin group: evoadmin - force: no + force: "{{ evoadmin_web_config_local_php_force | bool }}" + with_first_found: + - "templates/evoadmin-web/config.local.{{ inventory_hostname }}.conf.j2" + - "templates/evoadmin-web/config.local.{{ host_group }}.conf.j2" + - "templates/evoadmin-web/config.local.conf.j2" + - "config.local.conf.j2" + register: evoadmin_web_config_local_php_template \ No newline at end of file From 1fc8b2b9f910a84918d3a5b70b522d295601f974 Mon Sep 17 00:00:00 2001 From: Patrick Marchand Date: Mon, 6 May 2019 23:41:36 +0200 Subject: [PATCH 2/4] Fixed errors in filenames --- webapps/evoadmin-web/README.md | 8 ++++---- webapps/evoadmin-web/tasks/config.yml | 2 +- webapps/evoadmin-web/tasks/web.yml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/webapps/evoadmin-web/README.md b/webapps/evoadmin-web/README.md index 918e8004..bf5fd03e 100644 --- a/webapps/evoadmin-web/README.md +++ b/webapps/evoadmin-web/README.md @@ -17,12 +17,12 @@ And force it to update: - "templates/evoadmin-web/evoadmin.{{ host_group }}.conf.j2" - "templates/evoadmin-web/evoadmin.conf.j2" And force it to update: - evoadmin_web_conf_force: True + evoadmin_force_vhost: True # Set custom config.local.php -- "templates/evoadmin-web/config.local.{{ inventory_hostname }}.conf.j2" -- "templates/evoadmin-web/config.local.{{ host_group }}.conf.j2" -- "templates/evoadmin-web/config.local.conf.j2" +- "templates/evoadmin-web/config.local.{{ inventory_hostname }}.php.j2" +- "templates/evoadmin-web/config.local.{{ host_group }}.php.j2" +- "templates/evoadmin-web/config.local.php.j2" And force it to update: evoadmin_web_config_local_php_force: True diff --git a/webapps/evoadmin-web/tasks/config.yml b/webapps/evoadmin-web/tasks/config.yml index b36f8178..68423193 100644 --- a/webapps/evoadmin-web/tasks/config.yml +++ b/webapps/evoadmin-web/tasks/config.yml @@ -27,5 +27,5 @@ - "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2" - "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2" - "templates/evoadmin-web/web-mail.tpl.j2" - - "web-mail.default.tpl.j2" + - "web-mail.tpl.j2" register: web_mail_tpl_template \ No newline at end of file diff --git a/webapps/evoadmin-web/tasks/web.yml b/webapps/evoadmin-web/tasks/web.yml index 12ad23b6..8a79b8b2 100644 --- a/webapps/evoadmin-web/tasks/web.yml +++ b/webapps/evoadmin-web/tasks/web.yml @@ -54,8 +54,8 @@ group: evoadmin force: "{{ evoadmin_web_config_local_php_force | bool }}" with_first_found: - - "templates/evoadmin-web/config.local.{{ inventory_hostname }}.conf.j2" - - "templates/evoadmin-web/config.local.{{ host_group }}.conf.j2" - - "templates/evoadmin-web/config.local.conf.j2" + - "templates/evoadmin-web/config.local.{{ inventory_hostname }}.php.j2" + - "templates/evoadmin-web/config.local.{{ host_group }}.php.j2" + - "templates/evoadmin-web/config.local.php.j2" - "config.local.conf.j2" register: evoadmin_web_config_local_php_template \ No newline at end of file From 1ecc38f9c2646f1d12da98a308040431fa672c00 Mon Sep 17 00:00:00 2001 From: Patrick Marchand Date: Tue, 27 Aug 2019 09:45:32 -0400 Subject: [PATCH 3/4] Modified evoadmin-web template overriding variable names Made them more in line with the rest of the role. --- webapps/evoadmin-web/README.md | 8 ++++---- webapps/evoadmin-web/defaults/main.yml | 8 ++++---- webapps/evoadmin-web/tasks/config.yml | 8 ++++---- webapps/evoadmin-web/tasks/user.yml | 4 ++-- webapps/evoadmin-web/tasks/web.yml | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/webapps/evoadmin-web/README.md b/webapps/evoadmin-web/README.md index bf5fd03e..096a8378 100644 --- a/webapps/evoadmin-web/README.md +++ b/webapps/evoadmin-web/README.md @@ -3,14 +3,14 @@ - "templates/evoadmin-web/web-add.{{ host_group }}.conf.j2" - "templates/evoadmin-web/web-add.conf.j2" And force it to update: - web_add_conf_force: True + evoadmin_add_conf_force: True # Set custom web-mail.tpl - "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2" - "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2" - "templates/evoadmin-web/web-mail.tpl.j2" And force it to update: - web_mail_tpl_force: True + evoadmin_mail_tpl_force: True # Set custom evoadmin.conf VHost - "templates/evoadmin-web/evoadmin.{{ inventory_hostname }}.conf.j2" @@ -24,7 +24,7 @@ And force it to update: - "templates/evoadmin-web/config.local.{{ host_group }}.php.j2" - "templates/evoadmin-web/config.local.php.j2" And force it to update: - evoadmin_web_config_local_php_force: True + evoadmin_config_local_php_force: True # Set evoadmin-web sudoers file - "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2" @@ -32,4 +32,4 @@ And force it to update: - "templates/evoadmin-web/sudoers.j2" - "sudoers.j2" And force it to update: - evoadmin_web_sudoers_conf_force: True \ No newline at end of file + evoadmin_sudoers_conf_force: True \ No newline at end of file diff --git a/webapps/evoadmin-web/defaults/main.yml b/webapps/evoadmin-web/defaults/main.yml index fc77c234..b323a258 100644 --- a/webapps/evoadmin-web/defaults/main.yml +++ b/webapps/evoadmin-web/defaults/main.yml @@ -12,10 +12,10 @@ evoadmin_username: evoadmin evoadmin_enable_vhost: True evoadmin_force_vhost: False -evoadmin_web_config_local_php_force: False -evoadmin_web_sudoers_conf_force: False -web_add_conf_force: False -web_mail_tpl_force: False +evoadmin_config_local_php_force: False +evoadmin_sudoers_conf_force: False +evoadmin_add_conf_force: False +evoadmin_mail_tpl_force: False evoadmin_tpl_servername: "{{ ansible_fqdn }}" evoadmin_tpl_address: "{{ ansible_default_ipv4.address }}" diff --git a/webapps/evoadmin-web/tasks/config.yml b/webapps/evoadmin-web/tasks/config.yml index 68423193..691287df 100644 --- a/webapps/evoadmin-web/tasks/config.yml +++ b/webapps/evoadmin-web/tasks/config.yml @@ -10,22 +10,22 @@ template: src: "{{ item }}" dest: /etc/evolinux/web-add.conf - force: "{{ web_add_conf_force | bool }}" + force: "{{ evoadmin_add_conf_force | bool }}" with_first_found: - "templates/evoadmin-web/web-add.{{ inventory_hostname }}.conf.j2" - "templates/evoadmin-web/web-add.{{ host_group }}.conf.j2" - "templates/evoadmin-web/web-add.conf.j2" - "web-add.conf.j2" - register: web_add_conf_template + register: evoadmin__add_conf_template - name: Configure web-add template file for mail template: src: "{{ item }}" dest: "{{ evoadmin_scripts_dir }}/web-mail.tpl" - force: "{{ web_mail_tpl_force | bool }}" + force: "{{ evoadmin_mail_tpl_force | bool }}" with_first_found: - "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2" - "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2" - "templates/evoadmin-web/web-mail.tpl.j2" - "web-mail.tpl.j2" - register: web_mail_tpl_template \ No newline at end of file + register: evoadmin__mail_tpl_template \ No newline at end of file diff --git a/webapps/evoadmin-web/tasks/user.yml b/webapps/evoadmin-web/tasks/user.yml index 08a952a2..3200693e 100644 --- a/webapps/evoadmin-web/tasks/user.yml +++ b/webapps/evoadmin-web/tasks/user.yml @@ -106,11 +106,11 @@ src: "{{ item }}" dest: /etc/sudoers.d/evoadmin mode: "0600" - force: "{{ evoadmin_web_sudoers_conf_force | bool }}" + force: "{{ evoadmin_sudoers_conf_force | bool }}" validate: "visudo -cf %s" with_first_found: - "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2" - "templates/evoadmin-web/sudoers.{{ host_group }}.j2" - "templates/evoadmin-web/sudoers.j2" - "sudoers.j2" - register: evoadmin_web_sudoers_conf \ No newline at end of file + register: evoadmin_sudoers_conf \ No newline at end of file diff --git a/webapps/evoadmin-web/tasks/web.yml b/webapps/evoadmin-web/tasks/web.yml index 8a79b8b2..4aca3ba0 100644 --- a/webapps/evoadmin-web/tasks/web.yml +++ b/webapps/evoadmin-web/tasks/web.yml @@ -52,10 +52,10 @@ mode: "0640" owner: evoadmin group: evoadmin - force: "{{ evoadmin_web_config_local_php_force | bool }}" + force: "{{ evoadmin_config_local_php_force | bool }}" with_first_found: - "templates/evoadmin-web/config.local.{{ inventory_hostname }}.php.j2" - "templates/evoadmin-web/config.local.{{ host_group }}.php.j2" - "templates/evoadmin-web/config.local.php.j2" - "config.local.conf.j2" - register: evoadmin_web_config_local_php_template \ No newline at end of file + register: evoadmin_config_local_php_template \ No newline at end of file From 67664ec0e281bf7caace4028f0039d34782b3c74 Mon Sep 17 00:00:00 2001 From: Patrick Marchand Date: Tue, 27 Aug 2019 09:58:08 -0400 Subject: [PATCH 4/4] Pass evoadmin-web role through yamllint and ansible-lint Recommends using true or false values directly instead of the truthy and falsie yes True and etc. This also means that we can get rid of the cast to booleans in some of the checks. The other fixes are mostly in the realm of indentation and whitespace. --- webapps/evoadmin-web/defaults/main.yml | 22 ++++++++--------- webapps/evoadmin-web/meta/main.yml | 9 +++---- webapps/evoadmin-web/tasks/config.yml | 24 +++++++++---------- webapps/evoadmin-web/tasks/ftp.yml | 2 +- webapps/evoadmin-web/tasks/packages.yml | 8 +++---- webapps/evoadmin-web/tasks/user.yml | 32 +++++++++++++------------ webapps/evoadmin-web/tasks/web.yml | 24 +++++++++---------- 7 files changed, 62 insertions(+), 59 deletions(-) diff --git a/webapps/evoadmin-web/defaults/main.yml b/webapps/evoadmin-web/defaults/main.yml index b323a258..b5e94acc 100644 --- a/webapps/evoadmin-web/defaults/main.yml +++ b/webapps/evoadmin-web/defaults/main.yml @@ -1,6 +1,6 @@ --- general_alert_email: "root@localhost" -evoadmin_contact_email: Null +evoadmin_contact_email: null evoadmin_bounce_email: "{{ evoadmin_contact_email }}" evoadmin_home_dir: "/home/{{ evoadmin_username }}" @@ -10,19 +10,19 @@ evoadmin_scripts_dir: /usr/share/scripts/evoadmin evoadmin_host: "evoadmin.{{ ansible_fqdn }}" evoadmin_username: evoadmin -evoadmin_enable_vhost: True -evoadmin_force_vhost: False -evoadmin_config_local_php_force: False -evoadmin_sudoers_conf_force: False -evoadmin_add_conf_force: False -evoadmin_mail_tpl_force: False +evoadmin_enable_vhost: true +evoadmin_force_vhost: false +evoadmin_config_local_php_force: false +evoadmin_sudoers_conf_force: false +evoadmin_add_conf_force: false +evoadmin_mail_tpl_force: false evoadmin_tpl_servername: "{{ ansible_fqdn }}" -evoadmin_tpl_address: "{{ ansible_default_ipv4.address }}" -evoadmin_tpl_phpmyadmin_url: Null -evoadmin_tpl_cgi_suffix: Null +evoadmin_tpl_address: "{{ ansible_default_ipv4.address }}" +evoadmin_tpl_phpmyadmin_url: null +evoadmin_tpl_cgi_suffix: null evoadmin_tpl_signature: evoadmin evoadmin_tpl_mail_from: root@localhost -evoadmin_tpl_mail_bcc: Null +evoadmin_tpl_mail_bcc: null evoadmin_tpl_mail_standard: "{{ general_alert_email }}" evoadmin_tpl_mail_urgent: "{{ general_alert_email }}" diff --git a/webapps/evoadmin-web/meta/main.yml b/webapps/evoadmin-web/meta/main.yml index 3fbe0627..3a17ebc3 100644 --- a/webapps/evoadmin-web/meta/main.yml +++ b/webapps/evoadmin-web/meta/main.yml @@ -1,3 +1,4 @@ +--- galaxy_info: author: Evolix description: Installation of evoadmin-web @@ -9,10 +10,10 @@ galaxy_info: min_ansible_version: 2.2 platforms: - - name: Debian - versions: - - jessie - - stretch + - name: Debian + versions: + - jessie + - stretch dependencies: - proftpd diff --git a/webapps/evoadmin-web/tasks/config.yml b/webapps/evoadmin-web/tasks/config.yml index 691287df..2795653f 100644 --- a/webapps/evoadmin-web/tasks/config.yml +++ b/webapps/evoadmin-web/tasks/config.yml @@ -3,29 +3,29 @@ - name: "Create /etc/evolinux" file: dest: "/etc/evolinux" - recurse: yes + recurse: true state: directory - name: Configure web-add config file template: src: "{{ item }}" dest: /etc/evolinux/web-add.conf - force: "{{ evoadmin_add_conf_force | bool }}" + force: "{{ evoadmin_add_conf_force }}" with_first_found: - - "templates/evoadmin-web/web-add.{{ inventory_hostname }}.conf.j2" - - "templates/evoadmin-web/web-add.{{ host_group }}.conf.j2" - - "templates/evoadmin-web/web-add.conf.j2" - - "web-add.conf.j2" + - "templates/evoadmin-web/web-add.{{ inventory_hostname }}.conf.j2" + - "templates/evoadmin-web/web-add.{{ host_group }}.conf.j2" + - "templates/evoadmin-web/web-add.conf.j2" + - "web-add.conf.j2" register: evoadmin__add_conf_template - name: Configure web-add template file for mail template: src: "{{ item }}" dest: "{{ evoadmin_scripts_dir }}/web-mail.tpl" - force: "{{ evoadmin_mail_tpl_force | bool }}" + force: "{{ evoadmin_mail_tpl_force }}" with_first_found: - - "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2" - - "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2" - - "templates/evoadmin-web/web-mail.tpl.j2" - - "web-mail.tpl.j2" - register: evoadmin__mail_tpl_template \ No newline at end of file + - "templates/evoadmin-web/web-mail.{{ inventory_hostname }}.tpl.j2" + - "templates/evoadmin-web/web-mail.{{ host_group }}.tpl.j2" + - "templates/evoadmin-web/web-mail.tpl.j2" + - "web-mail.tpl.j2" + register: evoadmin__mail_tpl_template diff --git a/webapps/evoadmin-web/tasks/ftp.yml b/webapps/evoadmin-web/tasks/ftp.yml index d78d50ff..75c09d19 100644 --- a/webapps/evoadmin-web/tasks/ftp.yml +++ b/webapps/evoadmin-web/tasks/ftp.yml @@ -7,6 +7,6 @@ - name: Patch ProFTPd config file patch: - remote_src: no + remote_src: false src: ftp/evolinux.conf.diff dest: /etc/proftpd/conf.d/z-evolinux.conf diff --git a/webapps/evoadmin-web/tasks/packages.yml b/webapps/evoadmin-web/tasks/packages.yml index 79d1e312..2b0d013f 100644 --- a/webapps/evoadmin-web/tasks/packages.yml +++ b/webapps/evoadmin-web/tasks/packages.yml @@ -9,14 +9,14 @@ name: '{{ item }}' state: present with_items: - - php-pear - - php-log + - php-pear + - php-log - name: Install PHP5 packages apt: name: '{{ item }}' state: present - allow_unauthenticated: yes + allow_unauthenticated: true with_items: - - php5-pam + - php5-pam when: ansible_distribution_release == "jessie" diff --git a/webapps/evoadmin-web/tasks/user.yml b/webapps/evoadmin-web/tasks/user.yml index 3200693e..cd652a69 100644 --- a/webapps/evoadmin-web/tasks/user.yml +++ b/webapps/evoadmin-web/tasks/user.yml @@ -4,7 +4,7 @@ user: name: evoadmin comment: "Evoadmin Web Account" - home: "{{ evoadmin_home_dir}}" + home: "{{ evoadmin_home_dir }}" password: "!" - name: Create www-evoadmin group @@ -16,7 +16,7 @@ user: name: www-evoadmin groups: shadow - append: yes + append: true when: ansible_distribution_release == "jessie" - name: "Create www-evoadmin (Debian 9 or later)" @@ -36,8 +36,10 @@ regexp: "{{ item.regexp }}" state: present with_items: - - { line: 'evoadmin: root', regexp: '^evoadmin:'} - - { line: 'www-evoadmin: root', regexp: '^www-evoadmin:'} + - line: 'evoadmin: root' + regexp: '^evoadmin:' + - line: 'www-evoadmin: root' + regexp: '^www-evoadmin:' notify: "newaliases" when: etc_aliases.stat.exists @@ -51,7 +53,7 @@ repo: https://forge.evolix.org/evoadmin-web.git dest: "{{ evoadmin_document_root }}" version: jessie - update: no + update: false when: ansible_distribution_release == "jessie" - name: "Clone evoadmin repository (Debian 9 or later)" @@ -59,7 +61,7 @@ repo: https://forge.evolix.org/evoadmin-web.git dest: "{{ evoadmin_document_root }}" version: master - update: yes + update: false when: ansible_distribution_major_version | version_compare('9', '>=') - name: Change ownership on git repository @@ -67,7 +69,7 @@ dest: "{{ evoadmin_document_root }}" owner: "{{ evoadmin_username }}" group: "{{ evoadmin_username }}" - recurse: yes + recurse: true - name: Create evoadmin log directory file: @@ -97,20 +99,20 @@ command: "chmod -R --verbose u=rwX,g=rX,o= {{ evoadmin_document_root }}" register: command_result changed_when: "'changed' in command_result.stdout" - # failed_when: False + # failed_when: false args: - warn: no + warn: false - name: Add evoadmin sudoers file template: src: "{{ item }}" dest: /etc/sudoers.d/evoadmin mode: "0600" - force: "{{ evoadmin_sudoers_conf_force | bool }}" + force: "{{ evoadmin_sudoers_conf_force }}" validate: "visudo -cf %s" with_first_found: - - "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2" - - "templates/evoadmin-web/sudoers.{{ host_group }}.j2" - - "templates/evoadmin-web/sudoers.j2" - - "sudoers.j2" - register: evoadmin_sudoers_conf \ No newline at end of file + - "templates/evoadmin-web/sudoers.{{ inventory_hostname }}.j2" + - "templates/evoadmin-web/sudoers.{{ host_group }}.j2" + - "templates/evoadmin-web/sudoers.j2" + - "sudoers.j2" + register: evoadmin_sudoers_conf diff --git a/webapps/evoadmin-web/tasks/web.yml b/webapps/evoadmin-web/tasks/web.yml index 4aca3ba0..a7be4b04 100644 --- a/webapps/evoadmin-web/tasks/web.yml +++ b/webapps/evoadmin-web/tasks/web.yml @@ -22,12 +22,12 @@ template: src: "{{ item }}" dest: /etc/apache2/sites-available/evoadmin.conf - force: "{{ evoadmin_force_vhost | bool }}" + force: "{{ evoadmin_force_vhost }}" with_first_found: - - "templates/evoadmin-web/evoadmin.{{ inventory_hostname }}.conf.j2" - - "templates/evoadmin-web/evoadmin.{{ host_group }}.conf.j2" - - "templates/evoadmin-web/evoadmin.conf.j2" - - "evoadmin.conf.j2" + - "templates/evoadmin-web/evoadmin.{{ inventory_hostname }}.conf.j2" + - "templates/evoadmin-web/evoadmin.{{ host_group }}.conf.j2" + - "templates/evoadmin-web/evoadmin.conf.j2" + - "evoadmin.conf.j2" register: evoadmin_vhost_template notify: reload apache2 @@ -48,14 +48,14 @@ - name: Copy config file for evoadmin template: src: "{{ item }}" - dest: "{{ evoadmin_document_root}}/conf/config.local.php" + dest: "{{ evoadmin_document_root }}/conf/config.local.php" mode: "0640" owner: evoadmin group: evoadmin - force: "{{ evoadmin_config_local_php_force | bool }}" + force: "{{ evoadmin_config_local_php_force }}" with_first_found: - - "templates/evoadmin-web/config.local.{{ inventory_hostname }}.php.j2" - - "templates/evoadmin-web/config.local.{{ host_group }}.php.j2" - - "templates/evoadmin-web/config.local.php.j2" - - "config.local.conf.j2" - register: evoadmin_config_local_php_template \ No newline at end of file + - "templates/evoadmin-web/config.local.{{ inventory_hostname }}.php.j2" + - "templates/evoadmin-web/config.local.{{ host_group }}.php.j2" + - "templates/evoadmin-web/config.local.php.j2" + - "config.local.conf.j2" + register: evoadmin_config_local_php_template