From c593e480206cfe3fdae8fc62d7fdd24da7e2604f Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Mon, 9 Nov 2020 09:00:08 +0100 Subject: [PATCH] Update to 2020-11-09 09:00 --- roles/common/defaults/main.yml | 20 -------------------- roles/common/tasks/main.yml | 7 +++++++ roles/common/tasks/utils.yml | 23 +++-------------------- roles/common/vars/CentOS-7.yml | 13 +++++++++++++ roles/common/vars/CentOS-8.yml | 13 +++++++++++++ roles/common/vars/Debian-10.yml | 10 ++++++++++ roles/common/vars/Debian-9.yml | 9 +++++++++ roles/glpi/meta/main.yml | 3 +++ roles/glpi/tasks/conf.yml | 2 +- roles/glpi/tasks/install.yml | 1 - roles/system_proxy/tasks/main.yml | 12 ++++++++++++ roles/ttrss/defaults/main.yml | 4 ++-- roles/ttrss/tasks/main.yml | 23 +++++++++++++---------- roles/ttrss/vars/CentOS-7.yml | 6 ++++++ roles/ttrss/vars/CentOS-8.yml | 6 ++++++ 15 files changed, 98 insertions(+), 54 deletions(-) create mode 100644 roles/common/vars/CentOS-7.yml create mode 100644 roles/common/vars/CentOS-8.yml create mode 100644 roles/common/vars/Debian-10.yml create mode 100644 roles/common/vars/Debian-9.yml create mode 100644 roles/ttrss/vars/CentOS-7.yml create mode 100644 roles/ttrss/vars/CentOS-8.yml diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml index c4b3a9f..a324268 100644 --- a/roles/common/defaults/main.yml +++ b/roles/common/defaults/main.yml @@ -16,7 +16,6 @@ system_utils: - bzip2 - pbzip2 - lzop - - zstd - vim - bash-completion - rsync @@ -35,25 +34,6 @@ system_utils: - tree - mc -# List specific for EL based -system_utils_el: - - openssh-clients - - nc - - xz - - lz4 - - yum-utils - - fuse-sshfs - - "{{ ansible_distribution_major_version is version('8', '<') | ternary('policycoreutils-python','python3-policycoreutils') }}" - -# List specific for Debian based -system_utils_deb: - - apt-transport-https - - openssh-client - - netcat - - xz-utils - - liblz4-tool - - sshfs - # Kernel modules to load system_kmods: [] diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 494b0f4..f6b02d8 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,5 +1,12 @@ --- +- include_vars: "{{ item }}" + with_first_found: + - vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml + - vars/{{ ansible_distribution }}.yml + - vars/{{ ansible_os_family }}.yml + - vars/defaults.yml + - include_tasks: utils.yml - include_tasks: hostname.yml - include_tasks: tz.yml diff --git a/roles/common/tasks/utils.yml b/roles/common/tasks/utils.yml index 94d1348..4d7ea0d 100644 --- a/roles/common/tasks/utils.yml +++ b/roles/common/tasks/utils.yml @@ -1,29 +1,12 @@ --- - name: Install common utilities - yum: - name: "{{ system_utils }} + {{ system_utils_el }}" - when: ansible_os_family == 'RedHat' - -- name: Strip unsupported packages - set_fact: system_utils={{ system_utils | difference(['zstd']) }} - when: ansible_distribution == 'Debian' and ansible_distribution_major_version is version('9', '<') - -- name: Install common utilities - apt: - name: "{{ system_utils }} + {{ system_utils_deb }}" - update_cache: True - when: ansible_os_family == 'Debian' - -- name: Install extra softwares - yum: - name: "{{ system_extra_pkgs }}" - when: ansible_os_family == 'RedHat' + package: + name: "{{ system_utils + system_distro_utils}}" - name: Install extra softwares - apt: + package: name: "{{ system_extra_pkgs }}" - when: ansible_os_family == 'Debian' # Screendump is not used, and prevent using tab to use screen quickly, so remove it - name: Check if screendump is present diff --git a/roles/common/vars/CentOS-7.yml b/roles/common/vars/CentOS-7.yml new file mode 100644 index 0000000..99b3376 --- /dev/null +++ b/roles/common/vars/CentOS-7.yml @@ -0,0 +1,13 @@ +--- + +system_distro_utils: + - openssh-clients + - nc + - xz + - lz4 + - yum-utils + - fuse-sshfs + - policycoreutils-python + - MySQL-python + - python-psycopg2 + - zstd diff --git a/roles/common/vars/CentOS-8.yml b/roles/common/vars/CentOS-8.yml new file mode 100644 index 0000000..85ad251 --- /dev/null +++ b/roles/common/vars/CentOS-8.yml @@ -0,0 +1,13 @@ +--- + +system_distro_utils: + - openssh-clients + - nc + - xz + - lz4 + - yum-utils + - fuse-sshfs + - python3-policycoreutils + - python3-mysql + - python3-psycopg2 + - zstd diff --git a/roles/common/vars/Debian-10.yml b/roles/common/vars/Debian-10.yml new file mode 100644 index 0000000..11709c8 --- /dev/null +++ b/roles/common/vars/Debian-10.yml @@ -0,0 +1,10 @@ +--- + +system_distro_utils: + - apt-transport-https + - openssh-client + - netcat + - xz-utils + - liblz4-tool + - sshfs + - zstd diff --git a/roles/common/vars/Debian-9.yml b/roles/common/vars/Debian-9.yml new file mode 100644 index 0000000..c5a47f2 --- /dev/null +++ b/roles/common/vars/Debian-9.yml @@ -0,0 +1,9 @@ +--- + +system_distro_utils: + - apt-transport-https + - openssh-client + - netcat + - xz-utils + - liblz4-tool + - sshfs diff --git a/roles/glpi/meta/main.yml b/roles/glpi/meta/main.yml index c07f269..ddd97c1 100644 --- a/roles/glpi/meta/main.yml +++ b/roles/glpi/meta/main.yml @@ -2,4 +2,7 @@ allow_duplicates: true dependencies: - role: mkdir + - role: httpd_php + - role: mysql_server + when: glpi_mysql_server == 'localhost' or glpi_mysql_server == '127.0.0.1' ... diff --git a/roles/glpi/tasks/conf.yml b/roles/glpi/tasks/conf.yml index 660c76a..732488f 100644 --- a/roles/glpi/tasks/conf.yml +++ b/roles/glpi/tasks/conf.yml @@ -21,7 +21,7 @@ tags: glpi - name: Upgrade database - command: "/bin/php{{ (glpi_php_version == '54') | ternary('',glpi_php_version) }} {{ glpi_root_dir }}/web/bin/console -n db:update" + command: "/bin/php{{ glpi_php_version }} {{ glpi_root_dir }}/web/bin/console -n db:update" when: glpi_install_mode == 'upgrade' tags: glpi diff --git a/roles/glpi/tasks/install.yml b/roles/glpi/tasks/install.yml index 5d040b0..4502b32 100644 --- a/roles/glpi/tasks/install.yml +++ b/roles/glpi/tasks/install.yml @@ -4,7 +4,6 @@ yum: name: - unzip - - MySQL-python - tar - bzip2 - acl diff --git a/roles/system_proxy/tasks/main.yml b/roles/system_proxy/tasks/main.yml index 9e572fd..5bef8be 100644 --- a/roles/system_proxy/tasks/main.yml +++ b/roles/system_proxy/tasks/main.yml @@ -51,6 +51,18 @@ when: ansible_os_family == 'RedHat' tags: proxy +- name: Configure proxy for dnf + ini_file: + path: /etc/dnf/yum.conf + section: main + option: proxy + value: "{{ (system_proxy is defined and system_proxy != '') | ternary(system_proxy,'') }}" + state: "{{ (system_proxy is defined and system_proxy != '') | ternary('present','absent') }}" + when: + - ansible_os_family == 'RedHat' + - ansible_distribution_major_version is version('8', '>=') + tags: proxy + - name: Config proxy for apt copy: content: | diff --git a/roles/ttrss/defaults/main.yml b/roles/ttrss/defaults/main.yml index f85f4e0..6b60401 100644 --- a/roles/ttrss/defaults/main.yml +++ b/roles/ttrss/defaults/main.yml @@ -28,5 +28,5 @@ ttrss_php_version: 74 # - 10.32.0.0/16 # - 192.168.1.0/24 -# Public URL to access Tiny Tiny RSS, must be set -# ttrss_public_url: https://rss.example.org/ +# Public URL to access Tiny Tiny RSS +ttrss_public_url: https://{{ inventory_hostname }}/ diff --git a/roles/ttrss/tasks/main.yml b/roles/ttrss/tasks/main.yml index 7455f13..2cc3149 100644 --- a/roles/ttrss/tasks/main.yml +++ b/roles/ttrss/tasks/main.yml @@ -1,17 +1,20 @@ --- +- include_vars: "{{ item }}" + with_first_found: + - vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml + - vars/{{ ansible_distribution }}.yml + - vars/{{ ansible_os_family }}.yml + - vars/defaults.yml + - name: Set default install mode set_fact: ttrss_install_mode='none' - name: Set php executable - set_fact: ttrss_php_bin=/usr/bin/php{{ (ttrss_php_version == '54') | ternary('',ttrss_php_version) }} + set_fact: ttrss_php_bin=/usr/bin/php{{ ttrss_php_version }} - name: Install packages - yum: - name: - - git - - MySQL-python - - mariadb + yum: name={{ ttrss_packages }} - name: Create user account for PHP user: @@ -110,16 +113,16 @@ notify: reload httpd - name: Deploy PHP configuration - template: src=php.conf.j2 dest={{ httpd_php_versions[ttrss_php_version].conf_path }}/php-fpm.d/ttrss_{{ ttrss_id }}.conf + template: src=php.conf.j2 dest=/etc/opt/remi/php{{ ttrss_php_version }}/php-fpm.d/ttrss_{{ ttrss_id }}.conf notify: restart php-fpm - name: Remove PHP configuration from other versions - file: path={{ httpd_php_versions[item].conf_path }}/php-fpm.d/ttrss_{{ ttrss_id }}.conf state=absent - with_items: "{{ httpd_php_versions.keys() | list | difference([ ttrss_php_version ]) }}" + file: path=/etc/opt/remi/php{{ item }}/php-fpm.d/ttrss_{{ ttrss_id }}.conf state=absent + with_items: "{{ httpd_php_versions | difference([ ttrss_php_version ]) }}" notify: restart php-fpm - name: Remove PHP configuration (using a custom pool) - file: path={{ httpd_php_versions[ttrss_php_version].conf_path }}/php-fpm.d/ttrss_{{ ttrss_id }}.conf state=absent + file: path=/etc/opt/remi/php{{ ttrss_php_version }}/php-fpm.d/ttrss_{{ ttrss_id }}.conf state=absent when: ttrss_php_fpm_pool is defined notify: restart php-fpm diff --git a/roles/ttrss/vars/CentOS-7.yml b/roles/ttrss/vars/CentOS-7.yml new file mode 100644 index 0000000..39536ef --- /dev/null +++ b/roles/ttrss/vars/CentOS-7.yml @@ -0,0 +1,6 @@ +--- + +ttrss_packages: + - git + - MySQL-python + - mariadb diff --git a/roles/ttrss/vars/CentOS-8.yml b/roles/ttrss/vars/CentOS-8.yml new file mode 100644 index 0000000..c84a3a5 --- /dev/null +++ b/roles/ttrss/vars/CentOS-8.yml @@ -0,0 +1,6 @@ +--- + +ttrss_packages: + - git + - python3-mysql + - mariadb