--- - name: check if apt.conf uses a proxy shell: grep -Po '(?<=^Acquire::http::Proxy ")[^"]*' /etc/apt/apt.conf register: proxy_grep failed_when: false changed_when: false - name: set proxy variable set_fact: proxy: "{{ proxy_grep.stdout }}" when: proxy_grep.stdout != "" - name: install packages, debian8 tags: apt apt: name: - apache2 - libapache2-mod-php5 - mysql-client - php5-cli - php5-curl - php5-gd - php5-json - php5-ldap - php5-mysqlnd state: present when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "8" - name: install packages, debian9-10 tags: apt apt: name: - apache2 - libapache2-mod-php - mariadb-client - php-cli - php-bcmath - php-curl - php-gd - php-json - php-ldap - php-mbstring - php-mysql - php-soap - php-xml - php-zip state: present when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() == 9 or ansible_distribution_major_version|int() == 10 - name: sury repo pgp key, debian11-99 tags: apt shell: "curl {{ (proxy is defined) | ternary('--proxy '+ proxy|default(''), '')}} -o /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg" when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() >= 11 - name: sury repo in sources list, debian11 tags: apt lineinfile: dest: /etc/apt/sources.list.d/php-sury.list line: 'deb https://packages.sury.org/php/ bullseye main' create: yes when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() == 11 - name: sury repo in sources list, debian12 tags: apt lineinfile: dest: /etc/apt/sources.list.d/php-sury.list line: 'deb https://packages.sury.org/php/ bookworm main' create: yes when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() == 12 - name: sury repo in sources list, debian13 tags: apt lineinfile: dest: /etc/apt/sources.list.d/php-sury.list line: 'deb https://packages.sury.org/php/ trixie main' create: yes when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() == 13 - name: apt update, debian11-99 tags: apt apt: update_cache: yes when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() >= 11 - name: set phpver for debian11 set_fact: phpver: "7.4" when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() == 11 - name: set phpver for debian debian12 set_fact: phpver: "8.2" when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() == 12 - name: set phpver for debian debian12 set_fact: phpver: "8.4" when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() == 13 - name: set phpver for ubuntu20 set_fact: phpver: "7.4" # default, ubuntuba nem teszunk sury repot when: - ansible_distribution == "Ubuntu" - ansible_distribution_major_version|int() == 20 - name: set phpver for debian ubuntu22 set_fact: phpver: "8.1" # default, ubuntuba nem teszunk sury repot when: - ansible_distribution == "Ubuntu" - ansible_distribution_major_version|int() == 22 - name: install packages [phpver] tags: apt apt: name: - apache2 - mariadb-client - "php{{ phpver }}-cli" - "php{{ phpver }}-fpm" - "php{{ phpver }}-bcmath" - "php{{ phpver }}-curl" - "php{{ phpver }}-gd" - "php{{ phpver }}-ldap" - "php{{ phpver }}-mbstring" - "php{{ phpver }}-mongodb" - "php{{ phpver }}-mysql" - "php{{ phpver }}-opcache" - "php{{ phpver }}-readline" - "php{{ phpver }}-redis" - "php{{ phpver }}-soap" - "php{{ phpver }}-xml" - "php{{ phpver }}-zip" state: present when: - phpver is defined - name: install json for php7.4 [phpver] tags: apt apt: name: - "php{{ phpver }}-json" state: present when: - phpver is defined - phpver == "7.4" - name: php fpm/pool.d/www.conf [phpver] template: src: pool_www.conf dest: "/etc/php/{{ phpver }}/fpm/pool.d/www.conf" when: - phpver is defined - name: php config, debian8 copy: src: hws.php.ini.modphp dest: /etc/php5 when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "8" - name: php config symlinks, debian8 file: state: link src: /etc/php5/hws.php.ini path: "/etc/php5/{{ item }}/conf.d/hws.php.ini" with_items: - apache2 - cli when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "8" - name: php config, debian9 copy: src: hws.php.ini.modphp dest: /etc/php/7.0/hws.php.ini when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "9" - name: php config, debian10 copy: src: hws.php.ini.modphp dest: /etc/php/7.3/hws.php.ini when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "10" #- name: php config, bullseye # copy: # src: hws.php.ini.fpm # dest: /etc/php/7.4/hws.php.ini # when: # - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() == 11) or # (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20) - name: php config symlinks, debian9 file: state: link src: /etc/php/7.0/hws.php.ini path: "/etc/php/7.0/{{ item }}/conf.d/hws.php.ini" with_items: - apache2 - cli when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "9" - name: php config symlinks, debian10 file: state: link src: /etc/php/7.3/hws.php.ini path: "/etc/php/7.3/{{ item }}/conf.d/hws.php.ini" with_items: - apache2 - cli when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "10" #- name: php config symlinks, bullseye # file: # state: link # src: /etc/php/7.4/hws.php.ini # path: "/etc/php/7.4/{{ item }}/conf.d/hws.php.ini" # with_items: # - fpm # - cli # when: # - ansible_distribution == "Debian" # - ansible_distribution_major_version == "11" - name: php logrotate config copy: src: logrotate.conf dest: /etc/logrotate.d/php # vim: set tabstop=2 shiftwidth=2 expandtab smarttab: