From 5bcd0c9dede7bd387bbdfc865f0b8dec60421950 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 18 Feb 2025 01:10:48 -0600 Subject: [PATCH 01/15] for discussion --- ansible.cfg | 1 + scripts/ansible | 32 ++++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ansible.cfg b/ansible.cfg index deb5328ed..e1087d483 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -6,3 +6,4 @@ #squash_actions = apk, apt, dnf, homebrew, openbsd_pkg, pacman, pkgng, yum, zypper, package [defaults] interpreter_python=/usr/local/ansible/bin/python3 +collections_path=/usr/local/ansible/collections/ansible_collections/ diff --git a/scripts/ansible b/scripts/ansible index c5ab3e074..5ef9dfed9 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -9,6 +9,7 @@ APT_PATH=/usr/bin # Avoids problematic /usr/local/bin/apt on Linux Mint CURR_VER=undefined # Ansible version you have installed, e.g. [core 2.18.2] GOOD_VER=2.18.2 # Orig for 'yum install [rpm]' & XO laptops (pip install) +CWD=$(pwd) # 2021-06-22: The apt approach (with PPA source in /etc/apt/sources.list.d/ and # .gpg key etc) are commented out with ### below. Associated guidance/comments @@ -221,6 +222,15 @@ if [[ $(dpkg --print-architecture) == "i386" ]] && apt-cache show ansible-core > # 2023-08-10 #3613/#3615/#3617: apt-not-pip kludge for legacy 32-bit i386 # (DEBIAN 12+ ETC) avoids #3547 rust/wheels/cryptography compiling mess! $APT_PATH/apt -y install ansible-core # Bookworm ~= ansible-core 2.14.3 + echo -e "\n\nIIAB requires these ~4 Ansible Collections: (we upgrade them here if possible!)\n" + ansible-galaxy collection install --force-with-deps \ + -r /opt/iiab/iiab/collections.yml \ + -p /usr/share/ansible/collections +# 2021-02-24: 'ansible-galaxy collection list' lists those installed. (#2659) +# 2020-11-28: The ~3 Ansible Collections used by IIAB (~37MB) once lived here: +# /root/.ansible/collections/ansible_collections +# But going forward they'll be stored herein: [~24MB for 4 Collections as of 2021-05-19] +# /usr/share/ansible/collections/ansible_collections else # 2023-03-22: OS's like Ubuntu 23.04 and Debian 12 (e.g. with Python 3.11+) ask # that virtual environments (venv) be used to safely isolate pip installs: @@ -285,21 +295,22 @@ EOF for bin in ansible*; do ln -sf /usr/local/ansible/bin/"$bin" /usr/local/bin/"$bin" done -fi # (Re)running collection installs appears safe, with --force-with-deps to force # upgrade of collection and dependencies it pulls in. Note Ansible may support # explicit upgrading of collections (--upgrade / -U flag) in version "2.11" # with PR ansible/ansible#73336. See also IIAB PRs #2647 #2652 #2653 #2655. -echo -e "\n\nIIAB requires these ~4 Ansible Collections: (we upgrade them here if possible!)\n" -ansible-galaxy collection install --force-with-deps \ - -r /opt/iiab/iiab/collections.yml \ - -p /usr/share/ansible/collections -# 2021-02-24: 'ansible-galaxy collection list' lists those installed. (#2659) -# 2020-11-28: The ~3 Ansible Collections used by IIAB (~37MB) once lived here: -# /root/.ansible/collections/ansible_collections -# But going forward they'll be stored herein: [~24MB for 4 Collections as of 2021-05-19] -# /usr/share/ansible/collections/ansible_collections + echo "start is $CWD" + echo "current is $(pwd)" + echo -e "\n\nIIAB requires these ~4 Ansible Collections: (we upgrade them here if possible!)\n" + cp $CWD/collections.yml /usr/local/ansible/ + cd /usr/local/ansible/ + . bin/activate + bin/ansible-galaxy collection install --force-with-deps -r collections.yml -p collections + deactivate +fi +# But going forward they'll be stored herein: [~24MB for 4 Collections as of 2025-02-18] +# /usr/local/ansible/collections/ansible_collections # 2021-04-19: No longer needed, per PR #2743 testing #echo -e "\n\nCreating/verifying directory /etc/ansible & installing /etc/ansible/hosts\n" @@ -309,6 +320,7 @@ ansible-galaxy collection install --force-with-deps \ echo -e "\n\nSUCCESS! PLEASE VERIFY ANSIBLE WITH COMMANDS LIKE:\n" echo -e " ansible --version" echo -e " /usr/local/ansible/bin/pip3 show ansible-core" +echo -e " /usr/local/ansible/bin/ansible-galaxy collection list\n\n" echo -e ' apt -a list "ansible*"' echo -e " ansible-galaxy collection list\n\n" #echo -e "WARNING: Start a new Linux shell, if it changed from /usr/bin to /usr/local/bin\n\n" From afb5d356be68508168d16d903141cd7618ce56ce Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 18 Feb 2025 01:32:48 -0600 Subject: [PATCH 02/15] test failure runners --- .github/workflows/10min-iiab-test-install.yml | 2 ++ .github/workflows/30min-iiab-test-install-deb12-on-rpi3.yml | 2 ++ .../workflows/30min-iiab-test-install-raspios-on-zero2w.yml | 2 ++ scripts/ansible | 5 ++--- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/10min-iiab-test-install.yml b/.github/workflows/10min-iiab-test-install.yml index d2b8bd056..bf7a0b83e 100644 --- a/.github/workflows/10min-iiab-test-install.yml +++ b/.github/workflows/10min-iiab-test-install.yml @@ -51,6 +51,8 @@ jobs: sudo mkdir /etc/iiab # touch /etc/iiab/local_vars.yml sudo cp /opt/iiab/iiab/vars/local_vars_none.yml /etc/iiab/local_vars.yml + sudo mkdir /usr/local/bin/ansible + sudo cp /opt/iiab/iiab/collections.yml /usr/local/bin/ansible/ - run: sudo /opt/iiab/iiab/scripts/ansible - run: sudo ./iiab-install working-directory: /opt/iiab/iiab diff --git a/.github/workflows/30min-iiab-test-install-deb12-on-rpi3.yml b/.github/workflows/30min-iiab-test-install-deb12-on-rpi3.yml index a8703346e..dff53c1e0 100644 --- a/.github/workflows/30min-iiab-test-install-deb12-on-rpi3.yml +++ b/.github/workflows/30min-iiab-test-install-deb12-on-rpi3.yml @@ -58,6 +58,8 @@ jobs: ls /opt/iiab/iiab mkdir /etc/iiab cp /opt/iiab/iiab/vars/local_vars_none.yml /etc/iiab/local_vars.yml + mkdir /usr/local/bin/ansible + cp /opt/iiab/iiab/collections.yml /usr/local/bin/ansible/ /opt/iiab/iiab/scripts/ansible ./iiab-install cd /opt/iiab/iiab diff --git a/.github/workflows/30min-iiab-test-install-raspios-on-zero2w.yml b/.github/workflows/30min-iiab-test-install-raspios-on-zero2w.yml index 9b521fee6..9c4c7f1af 100644 --- a/.github/workflows/30min-iiab-test-install-raspios-on-zero2w.yml +++ b/.github/workflows/30min-iiab-test-install-raspios-on-zero2w.yml @@ -70,6 +70,8 @@ jobs: ls /opt/iiab/iiab mkdir /etc/iiab cp /opt/iiab/iiab/vars/local_vars_none.yml /etc/iiab/local_vars.yml + mkdir /usr/local/bin/ansible + cp /opt/iiab/iiab/collections.yml /usr/local/bin/ansible/ /opt/iiab/iiab/scripts/ansible ./iiab-install cd /opt/iiab/iiab diff --git a/scripts/ansible b/scripts/ansible index 5ef9dfed9..54962723a 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -290,6 +290,8 @@ EOF # - 'apt -y install libffi-dev python3-dev' # - painstaking pinning of cryptography or cffi (etc) to older version #s /usr/local/ansible/bin/python3 -m pip install --prefer-binary --upgrade ansible-core + # test github runners fail without true + cp $CWD/collections.yml /usr/local/ansible/ || true echo -e "\nCreate symlinks /usr/local/bin/ansible* -> /usr/local/ansible/bin/ansible*" cd /usr/local/ansible/bin for bin in ansible*; do @@ -300,10 +302,7 @@ EOF # upgrade of collection and dependencies it pulls in. Note Ansible may support # explicit upgrading of collections (--upgrade / -U flag) in version "2.11" # with PR ansible/ansible#73336. See also IIAB PRs #2647 #2652 #2653 #2655. - echo "start is $CWD" - echo "current is $(pwd)" echo -e "\n\nIIAB requires these ~4 Ansible Collections: (we upgrade them here if possible!)\n" - cp $CWD/collections.yml /usr/local/ansible/ cd /usr/local/ansible/ . bin/activate bin/ansible-galaxy collection install --force-with-deps -r collections.yml -p collections From 62c4edf2294d063f70eb68c81e7dfa09651f5df7 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 18 Feb 2025 07:24:29 -0600 Subject: [PATCH 03/15] test failure runners2 --- .github/workflows/10min-iiab-test-install.yml | 4 ++-- .../workflows/30min-iiab-test-install-deb12-on-rpi3.yml | 4 ++-- .../30min-iiab-test-install-raspios-on-zero2w.yml | 4 ++-- scripts/ansible | 7 +++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/10min-iiab-test-install.yml b/.github/workflows/10min-iiab-test-install.yml index bf7a0b83e..55b3f9c5b 100644 --- a/.github/workflows/10min-iiab-test-install.yml +++ b/.github/workflows/10min-iiab-test-install.yml @@ -51,8 +51,8 @@ jobs: sudo mkdir /etc/iiab # touch /etc/iiab/local_vars.yml sudo cp /opt/iiab/iiab/vars/local_vars_none.yml /etc/iiab/local_vars.yml - sudo mkdir /usr/local/bin/ansible - sudo cp /opt/iiab/iiab/collections.yml /usr/local/bin/ansible/ + sudo mkdir /usr/local/ansible + sudo cp /opt/iiab/iiab/collections.yml /usr/local/ansible/collections.yml - run: sudo /opt/iiab/iiab/scripts/ansible - run: sudo ./iiab-install working-directory: /opt/iiab/iiab diff --git a/.github/workflows/30min-iiab-test-install-deb12-on-rpi3.yml b/.github/workflows/30min-iiab-test-install-deb12-on-rpi3.yml index dff53c1e0..cf042837a 100644 --- a/.github/workflows/30min-iiab-test-install-deb12-on-rpi3.yml +++ b/.github/workflows/30min-iiab-test-install-deb12-on-rpi3.yml @@ -58,8 +58,8 @@ jobs: ls /opt/iiab/iiab mkdir /etc/iiab cp /opt/iiab/iiab/vars/local_vars_none.yml /etc/iiab/local_vars.yml - mkdir /usr/local/bin/ansible - cp /opt/iiab/iiab/collections.yml /usr/local/bin/ansible/ + mkdir /usr/local/ansible + cp /opt/iiab/iiab/collections.yml /usr/local/ansible/collections.yml /opt/iiab/iiab/scripts/ansible ./iiab-install cd /opt/iiab/iiab diff --git a/.github/workflows/30min-iiab-test-install-raspios-on-zero2w.yml b/.github/workflows/30min-iiab-test-install-raspios-on-zero2w.yml index 9c4c7f1af..3b4502dde 100644 --- a/.github/workflows/30min-iiab-test-install-raspios-on-zero2w.yml +++ b/.github/workflows/30min-iiab-test-install-raspios-on-zero2w.yml @@ -70,8 +70,8 @@ jobs: ls /opt/iiab/iiab mkdir /etc/iiab cp /opt/iiab/iiab/vars/local_vars_none.yml /etc/iiab/local_vars.yml - mkdir /usr/local/bin/ansible - cp /opt/iiab/iiab/collections.yml /usr/local/bin/ansible/ + mkdir /usr/local/ansible + cp /opt/iiab/iiab/collections.yml /usr/local/ansible/collections.yml /opt/iiab/iiab/scripts/ansible ./iiab-install cd /opt/iiab/iiab diff --git a/scripts/ansible b/scripts/ansible index 54962723a..03a446b5b 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -290,8 +290,6 @@ EOF # - 'apt -y install libffi-dev python3-dev' # - painstaking pinning of cryptography or cffi (etc) to older version #s /usr/local/ansible/bin/python3 -m pip install --prefer-binary --upgrade ansible-core - # test github runners fail without true - cp $CWD/collections.yml /usr/local/ansible/ || true echo -e "\nCreate symlinks /usr/local/bin/ansible* -> /usr/local/ansible/bin/ansible*" cd /usr/local/ansible/bin for bin in ansible*; do @@ -303,10 +301,11 @@ EOF # explicit upgrading of collections (--upgrade / -U flag) in version "2.11" # with PR ansible/ansible#73336. See also IIAB PRs #2647 #2652 #2653 #2655. echo -e "\n\nIIAB requires these ~4 Ansible Collections: (we upgrade them here if possible!)\n" + # test github runners fail without '|| true' + cp $CWD/collections.yml /usr/local/ansible/ || true cd /usr/local/ansible/ . bin/activate - bin/ansible-galaxy collection install --force-with-deps -r collections.yml -p collections - deactivate + bin/ansible-galaxy collection install --force-with-deps -r collections.yml -p collections deactivate fi # But going forward they'll be stored herein: [~24MB for 4 Collections as of 2025-02-18] # /usr/local/ansible/collections/ansible_collections From 71984b53dabfad265d2af3bf46ef6f79bb698ac3 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 18 Feb 2025 07:54:02 -0600 Subject: [PATCH 04/15] opps --- scripts/ansible | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index 03a446b5b..95d8fb5b1 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -305,7 +305,8 @@ EOF cp $CWD/collections.yml /usr/local/ansible/ || true cd /usr/local/ansible/ . bin/activate - bin/ansible-galaxy collection install --force-with-deps -r collections.yml -p collections deactivate + bin/ansible-galaxy collection install --force-with-deps -r collections.yml -p collections + deactivate fi # But going forward they'll be stored herein: [~24MB for 4 Collections as of 2025-02-18] # /usr/local/ansible/collections/ansible_collections From 910f073a74f4647fac84dd5ffd1d82ea8ea04518 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 18 Feb 2025 20:14:56 -0600 Subject: [PATCH 05/15] i386 --- scripts/ansible | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/ansible b/scripts/ansible index 95d8fb5b1..7966480a0 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -223,9 +223,15 @@ if [[ $(dpkg --print-architecture) == "i386" ]] && apt-cache show ansible-core > # (DEBIAN 12+ ETC) avoids #3547 rust/wheels/cryptography compiling mess! $APT_PATH/apt -y install ansible-core # Bookworm ~= ansible-core 2.14.3 echo -e "\n\nIIAB requires these ~4 Ansible Collections: (we upgrade them here if possible!)\n" + cat > ansible.cfg << EOF +'[defaults]' +'interpreter_python=/usr/bin/python3' >> $CWD/ansible.cfg +EOF + git commit -a -m"altering ansible.cfg for deb install" ansible-galaxy collection install --force-with-deps \ -r /opt/iiab/iiab/collections.yml \ -p /usr/share/ansible/collections + # 2021-02-24: 'ansible-galaxy collection list' lists those installed. (#2659) # 2020-11-28: The ~3 Ansible Collections used by IIAB (~37MB) once lived here: # /root/.ansible/collections/ansible_collections From c2b634a6d2a3fc8c5e4df5c6b680ea3493e383f4 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 20 Feb 2025 15:29:33 -0600 Subject: [PATCH 06/15] pip -> ansible.builtin.pip --- roles/calibre-web/tasks/install.yml | 2 +- roles/jupyterhub/tasks/install.yml | 4 ++-- roles/kalite/tasks/install.yml | 4 ++-- roles/lokole/tasks/install.yml | 6 +++--- roles/munin/tasks/install.yml | 2 +- roles/mysql/tasks/install.yml | 2 +- roles/postgresql/tasks/install.yml | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/roles/calibre-web/tasks/install.yml b/roles/calibre-web/tasks/install.yml index d293afe23..5f21b6394 100644 --- a/roles/calibre-web/tasks/install.yml +++ b/roles/calibre-web/tasks/install.yml @@ -134,7 +134,7 @@ fi - name: Download Calibre-Web dependencies from 'requirements.txt' into python3 virtual environment {{ calibreweb_venv_path }} - pip: + ansible.builtin.pip: requirements: "{{ calibreweb_venv_path }}/requirements.txt" virtualenv: "{{ calibreweb_venv_path }}" # /usr/local/calibre-web-py3 #virtualenv_site_packages: no diff --git a/roles/jupyterhub/tasks/install.yml b/roles/jupyterhub/tasks/install.yml index 57a503014..359f63705 100644 --- a/roles/jupyterhub/tasks/install.yml +++ b/roles/jupyterhub/tasks/install.yml @@ -44,7 +44,7 @@ state: latest - name: "pip install 3 packages into virtual environment: {{ jupyterhub_venv }} (~316 MB total, after 2 Ansible calls)" - pip: + ansible.builtin.pip: name: - pip - wheel @@ -61,7 +61,7 @@ # https://github.com/iiab/iiab/issues/3283 - name: Break up jupyterhub/jupyterlab pip installs into 2 parts (3 packages above + 4 packages here) due to mutual dependency deadlock on some OS's - pip: + ansible.builtin.pip: name: - jupyterlab - jupyterhub_firstuseauthenticator diff --git a/roles/kalite/tasks/install.yml b/roles/kalite/tasks/install.yml index 5738c7301..b1e16a680 100644 --- a/roles/kalite/tasks/install.yml +++ b/roles/kalite/tasks/install.yml @@ -29,7 +29,7 @@ when: is_debian_12 # Also covers is_raspbian_12 - name: Use pip to pin setuptools to 44 in {{ kalite_venv }} -- if Ubuntu 22.04 / Mint 21, Ubuntu 23.10, Debian 12 or RasPiOS 12 - pip: + ansible.builtin.pip: name: setuptools==44 virtualenv: "{{ kalite_venv }}" # /usr/local/kalite/venv virtualenv_site_packages: no @@ -39,7 +39,7 @@ when: is_ubuntu_2204 or is_ubuntu_2310 or is_debian_12 # Also covers is_linuxmint_21 and is_raspbian_12 - name: Use pip to install ka-lite-static to {{ kalite_venv }} -- if Ubuntu 22.04 / Mint 21, Ubuntu 23.10, Debian 12 or RasPiOS 12 - pip: + ansible.builtin.pip: name: ka-lite-static version: "{{ kalite_version }}" virtualenv: "{{ kalite_venv }}" diff --git a/roles/lokole/tasks/install.yml b/roles/lokole/tasks/install.yml index a002268fc..fa0ea3709 100644 --- a/roles/lokole/tasks/install.yml +++ b/roles/lokole/tasks/install.yml @@ -32,7 +32,7 @@ # following line to roles/lokole/defaults/main.yml: # lokole_commit: - name: "OPTIONAL: pip install opwen_email_client (Lokole, git commit {{ lokole_commit }}) from GitHub to {{ lokole_venv }}, if lokole_commit is defined" - pip: + ansible.builtin.pip: name: "git+{{ lokole_repo }}@{{ lokole_commit }}#egg=opwen_email_client" virtualenv: "{{ lokole_venv }}" virtualenv_command: python3 -m venv "{{ lokole_venv }}" @@ -43,7 +43,7 @@ # the following line to roles/lokole/defaults/main.yml: # lokole_version: - name: "OPTIONAL: pip install opwen_email_client (Lokole, version {{ lokole_version }}) from PyPI to {{ lokole_venv }}, if lokole_version is defined" - pip: + ansible.builtin.pip: name: opwen_email_client version: "{{ lokole_version }}" virtualenv: "{{ lokole_venv }}" @@ -52,7 +52,7 @@ when: lokole_version is defined - name: "DEFAULT: pip install opwen_email_client (Lokole, latest available version) from PyPI to {{ lokole_venv }}, if above vars both UNdefined" - pip: + ansible.builtin.pip: name: opwen_email_client virtualenv: "{{ lokole_venv }}" virtualenv_command: python3 -m venv "{{ lokole_venv }}" diff --git a/roles/munin/tasks/install.yml b/roles/munin/tasks/install.yml index 89fe254cf..6757e2c98 100644 --- a/roles/munin/tasks/install.yml +++ b/roles/munin/tasks/install.yml @@ -21,7 +21,7 @@ state: present - name: pip install 'passlib' into venv /usr/local/ansible -- for Ansible module 'htpasswd' in Ansible collection community.general -- used just below - pip: + ansible.builtin.pip: name: passlib virtualenv: /usr/local/ansible extra_args: "--upgrade --no-cache-dir --prefer-binary" # 2023-10-01: Lifesaver when recent wheels (e.g. piwheels.org) are inevitably not yet built! SEE #3560 diff --git a/roles/mysql/tasks/install.yml b/roles/mysql/tasks/install.yml index 1b8a04388..fe9a72433 100644 --- a/roles/mysql/tasks/install.yml +++ b/roles/mysql/tasks/install.yml @@ -14,7 +14,7 @@ state: present - name: pip install 'PyMySQL' into venv /usr/local/ansible -- for Ansible modules {mysql_db, mysql_user} in Ansible collection community.mysql -- used in roles {mediawiki, nextcloud, wordpress, matomo, pbx} - pip: + ansible.builtin.pip: name: PyMySQL virtualenv: /usr/local/ansible extra_args: "--upgrade --no-cache-dir --prefer-binary" # 2023-10-01: Lifesaver when recent wheels (e.g. piwheels.org) are inevitably not yet built! SEE #3560 diff --git a/roles/postgresql/tasks/install.yml b/roles/postgresql/tasks/install.yml index ce14600c5..924b6024f 100644 --- a/roles/postgresql/tasks/install.yml +++ b/roles/postgresql/tasks/install.yml @@ -12,7 +12,7 @@ state: present - name: pip install 'psycopg' (NEW Psycopg 3) into venv /usr/local/ansible -- for Ansible modules {postgresql_db, postgresql_user} in Ansible collection community.postgresql -- used in moodle/tasks/install.yml - pip: + ansible.builtin.pip: name: psycopg virtualenv: /usr/local/ansible extra_args: "--upgrade --no-cache-dir --prefer-binary" # 2023-10-01: Lifesaver when recent wheels (e.g. piwheels.org) are inevitably not yet built! SEE #3560 From 6f0ceb78a4cb371027e7b096503178df6114be6d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 20 Feb 2025 15:35:42 -0600 Subject: [PATCH 07/15] htpassw-> community.general.htpassw --- roles/munin/tasks/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/munin/tasks/install.yml b/roles/munin/tasks/install.yml index 6757e2c98..24528b438 100644 --- a/roles/munin/tasks/install.yml +++ b/roles/munin/tasks/install.yml @@ -33,7 +33,7 @@ value: 1 - name: Establish username/password Admin/changeme in /etc/munin/munin-htpasswd - htpasswd: + community.general.htpasswd: path: /etc/munin/munin-htpasswd name: "{{ munin_username}}" # Admin password: "{{ munin_password }}" # changeme From a706531c84514e87a71039e7d08ce271acebb3e0 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 20 Feb 2025 15:45:14 -0600 Subject: [PATCH 08/15] sysctl -> ansible.posix.sysctl --- collections.yml | 3 ++- roles/2-common/tasks/main.yml | 2 +- roles/munin/tasks/install.yml | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/collections.yml b/collections.yml index f65d3a552..ae2996e4a 100644 --- a/collections.yml +++ b/collections.yml @@ -7,8 +7,9 @@ collections: - name: community.general - name: community.mysql - name: community.postgresql - - name: ansible.posix # 2020-11-28: For ~3 modules below... + - name: ansible.posix # 2025-02-20: For ~4 modules below... # selinux WAS in /opt/iiab/iiab/roles/1-prep/tasks/main.yml # sysctl in /opt/iiab/iiab/roles/2-common/tasks/main.yml +# munin /opt/iiab/iiab/roles/munin/tasks/install.yml # synchronize in /opt/iiab/iiab-admin-console/roles/js-menu/tasks/main.yml diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index c6fb3f21c..9737fecc4 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -9,7 +9,7 @@ - include_tasks: packages.yml - name: "Use 'sysctl' to set 'kernel.core_uses_pid: 1' in /etc/sysctl.conf" - sysctl: # Places these settings in /etc/sysctl.conf, to survive reboot + ansible.posix.sysctl: # Places these settings in /etc/sysctl.conf, to survive reboot name: "{{ item.name }}" value: "{{ item.value }}" with_items: diff --git a/roles/munin/tasks/install.yml b/roles/munin/tasks/install.yml index 24528b438..a46f0d877 100644 --- a/roles/munin/tasks/install.yml +++ b/roles/munin/tasks/install.yml @@ -5,7 +5,7 @@ # SEE ALSO roles/network/tasks/install.yml - name: "TEMPORARILY REVERT net.ipv6.conf.all.disable_ipv6 to 0 in /etc/sysctl.conf for #3434" - sysctl: + ansible.posix.sysctl: name: net.ipv6.conf.all.disable_ipv6 value: 0 @@ -28,7 +28,7 @@ # SEE ALSO roles/network/tasks/install.yml - name: RESTORE net.ipv6.conf.all.disable_ipv6 to 1 in /etc/sysctl.conf for #3434 - sysctl: + ansible.posix.sysctl: name: net.ipv6.conf.all.disable_ipv6 value: 1 From 9fb521953c04ee40a2602f7faa4dcef8a8bb6af8 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 20 Feb 2025 16:06:51 -0600 Subject: [PATCH 09/15] community.postgresql --- roles/moodle/tasks/install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/moodle/tasks/install.yml b/roles/moodle/tasks/install.yml index 00cf13066..5ec80d2dc 100644 --- a/roles/moodle/tasks/install.yml +++ b/roles/moodle/tasks/install.yml @@ -134,7 +134,7 @@ state: started - name: Create PostgreSQL db user {{ moodle_db_user }}/{{ moodle_db_pass }} - postgresql_user: + community.postgresql.postgresql_user: name: "{{ moodle_db_user }}" # Admin password: "{{ moodle_db_pass }}" # changeme encrypted: yes # Required by PostgreSQL 10+ e.g. Ubuntu 18.04's PostgreSQL 10.3+, see https://github.com/iiab/iiab/issues/759 @@ -144,7 +144,7 @@ become_user: postgres - name: 'Create database: {{ moodle_db_name }}' - postgresql_db: + community.postgresql.postgresql_db: name: "{{ moodle_db_name }}" encoding: utf8 owner: "{{ moodle_db_user }}" From 1c1606cf52e838c641db6dbb91fe36a7adbc4a7d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 20 Feb 2025 16:24:03 -0600 Subject: [PATCH 10/15] community.mysql --- roles/mediawiki/tasks/install.yml | 4 ++-- roles/nextcloud/tasks/setup.yml | 4 ++-- roles/pbx/tasks/freepbx.yml | 6 +++--- roles/wordpress/tasks/setup.yml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/mediawiki/tasks/install.yml b/roles/mediawiki/tasks/install.yml index e89afdcd9..369f676eb 100644 --- a/roles/mediawiki/tasks/install.yml +++ b/roles/mediawiki/tasks/install.yml @@ -67,12 +67,12 @@ state: started - name: Create MySQL database {{ mediawiki_db_name }} - mysql_db: + community.mysql.mysql_db: name: "{{ mediawiki_db_name }}" # iiab_mediawiki #state: present - name: Create MySQL database user {{ mediawiki_db_user }} with password, and permissions to above db - mysql_user: + community.mysql.mysql_user: name: "{{ mediawiki_db_user }}" # iiab_mediawiki_user password: "{{ mediawiki_db_user_password }}" priv: "{{ mediawiki_db_name }}.*:ALL,GRANT" diff --git a/roles/nextcloud/tasks/setup.yml b/roles/nextcloud/tasks/setup.yml index 2278c7118..a65ab3e6e 100644 --- a/roles/nextcloud/tasks/setup.yml +++ b/roles/nextcloud/tasks/setup.yml @@ -1,9 +1,9 @@ - name: 'Create MySQL database with name: {{ nextcloud_dbname }}' - mysql_db: + community.mysql.mysql_db: name: "{{ nextcloud_dbname }}" - name: Add username/password to the MySQL database (associated with trusted IP's like localhost) - mysql_user: + community.mysql.mysql_user: name: "{{ nextcloud_dbuser }}" host: "{{ item }}" password: "{{ nextcloud_dbpassword }}" diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index 1bba7773c..cc6a0cf43 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -150,7 +150,7 @@ - name: FreePBX - Add MySQL user ({{ asterisk_db_user }}) - mysql_user: + community.mysql.mysql_user: name: "{{ asterisk_db_user }}" # asterisk password: "{{ asterisk_db_password }}" # asterisk priv: "{{ asterisk_db_dbname }}.*:ALL/{{ asterisk_db_cdrdbname }}.*:ALL" @@ -160,7 +160,7 @@ host: "{{ (asterisk_db_host == 'localhost') | ternary('localhost', ansible_default_ipv4.address) }}" - name: FreePBX - Add MySQL db ({{ asterisk_db_dbname }}) - mysql_db: + community.mysql.mysql_db: name: "{{ asterisk_db_dbname }}" # asterisk encoding: utf8 collation: utf8_general_ci @@ -169,7 +169,7 @@ login_password: "{{ asterisk_db_password }}" - name: FreePBX - Add CDR MySQL db ({{ asterisk_db_cdrdbname }}) - mysql_db: + community.mysql.mysql_db: name: "{{ asterisk_db_cdrdbname }}" # asteriskcdrdb encoding: utf8 collation: utf8_general_ci diff --git a/roles/wordpress/tasks/setup.yml b/roles/wordpress/tasks/setup.yml index 38ddb87f7..8a7601d47 100644 --- a/roles/wordpress/tasks/setup.yml +++ b/roles/wordpress/tasks/setup.yml @@ -4,11 +4,11 @@ name: "{{ mysql_service }}" - name: 'Create MySQL database for WordPress: {{ wp_db_name }}' - mysql_db: + community.mysql.mysql_db: name: "{{ wp_db_name }}" - name: Create MySQL username ({{ wp_db_user }}) with password, for above database - mysql_user: + community.mysql.mysql_user: name: "{{ wp_db_user }}" password: "{{ wp_db_user_password }}" priv: "{{ wp_db_name }}.*:ALL,GRANT" From 22b31998638ae70e813cf643080f93af3fb38f9e Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 20 Feb 2025 15:58:23 -0600 Subject: [PATCH 11/15] prep for moving collections --- vars/default_vars.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index a45384e1e..195acec53 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -32,6 +32,10 @@ iiab_env_file: "{{ iiab_etc_path }}/iiab.env" iiab_ini_file: "{{ iiab_etc_path }}/iiab.ini" iiab_state_file: "{{ iiab_etc_path }}/iiab_state.yml" +# keep syncd with scripts/ansible +ansible_venv_path: /usr/local/ansible +ansible_collections_path: "{{ ansible_venv_path }}/collections" + iiab_base: /opt/iiab iiab_dir: "{{ iiab_base }}/iiab" pip_packages_dir: "{{ iiab_base }}/pip-packages" From 55b572cda0a70cce4e2de7cdc75eb7c0a94db422 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 20 Feb 2025 16:55:01 -0600 Subject: [PATCH 12/15] community.postgresql on-demand --- collections.yml | 3 ++- roles/postgresql/tasks/install.yml | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/collections.yml b/collections.yml index ae2996e4a..970d5559a 100644 --- a/collections.yml +++ b/collections.yml @@ -6,7 +6,8 @@ collections: - name: community.general - name: community.mysql - - name: community.postgresql +# 2025-02-20 moved to /opt/iiab/iiab/roles/postgresql/tasks/install.yml +# - name: community.postgresql - name: ansible.posix # 2025-02-20: For ~4 modules below... # selinux WAS in /opt/iiab/iiab/roles/1-prep/tasks/main.yml diff --git a/roles/postgresql/tasks/install.yml b/roles/postgresql/tasks/install.yml index 924b6024f..9c4926a8b 100644 --- a/roles/postgresql/tasks/install.yml +++ b/roles/postgresql/tasks/install.yml @@ -14,9 +14,12 @@ - name: pip install 'psycopg' (NEW Psycopg 3) into venv /usr/local/ansible -- for Ansible modules {postgresql_db, postgresql_user} in Ansible collection community.postgresql -- used in moodle/tasks/install.yml ansible.builtin.pip: name: psycopg - virtualenv: /usr/local/ansible + virtualenv: "{{ ansible_venv_path }}" extra_args: "--upgrade --no-cache-dir --prefer-binary" # 2023-10-01: Lifesaver when recent wheels (e.g. piwheels.org) are inevitably not yet built! SEE #3560 +- name: Install Collection community.postgresql with ansible-galaxy + shell: "{{ ansible_venv_path }}/bin/ansible-galaxy collection install --force-with-deps community.postgresql -p {{ ansible_collections_path }}" + - name: Run shell command "pg_config --version" to extract MAJOR version number -- strip off MINOR/PATCH version number(s) shell: pg_config --version | sed 's/^[^0-9]*//; s/[^0-9].*//' register: pg_config_version From 5539b6c75f40da4dd66cb8bb6feeee2ee9a04c4f Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 20 Feb 2025 17:18:23 -0600 Subject: [PATCH 13/15] community.mysql on-demand --- collections.yml | 6 ++++-- roles/mysql/tasks/install.yml | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/collections.yml b/collections.yml index 970d5559a..5b2bec520 100644 --- a/collections.yml +++ b/collections.yml @@ -4,8 +4,10 @@ --- collections: - - name: community.general - - name: community.mysql +# 2025-02-20 community.general.ini_file + - name: community.general # community.general.ini_file +# 2025-02-20 moved to /opt/iiab/iiab/roles/mysql/tasks/install.yml +# - name: community.mysql # 2025-02-20 moved to /opt/iiab/iiab/roles/postgresql/tasks/install.yml # - name: community.postgresql - name: ansible.posix # 2025-02-20: For ~4 modules below... diff --git a/roles/mysql/tasks/install.yml b/roles/mysql/tasks/install.yml index fe9a72433..11ddc5900 100644 --- a/roles/mysql/tasks/install.yml +++ b/roles/mysql/tasks/install.yml @@ -16,9 +16,12 @@ - name: pip install 'PyMySQL' into venv /usr/local/ansible -- for Ansible modules {mysql_db, mysql_user} in Ansible collection community.mysql -- used in roles {mediawiki, nextcloud, wordpress, matomo, pbx} ansible.builtin.pip: name: PyMySQL - virtualenv: /usr/local/ansible + virtualenv: "{{ ansible_venv_path }}" extra_args: "--upgrade --no-cache-dir --prefer-binary" # 2023-10-01: Lifesaver when recent wheels (e.g. piwheels.org) are inevitably not yet built! SEE #3560 +- name: Install Collection community.mysql with ansible-galaxy + shell: "{{ ansible_venv_path }}/bin/ansible-galaxy collection install --force-with-deps community.mysql -p {{ ansible_collections_path }}" + # 2020-07-11: 10 PHP package installs moved to roles/www_base/tasks/main.yml # php{{ php_version }}-sqlite3 install moved to roles/osm-vector-maps/tasks/install.yml From c6037621fb95a234289fb7531b2d076c018238c3 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 20 Feb 2025 17:39:20 -0600 Subject: [PATCH 14/15] Set 'ansible_collections_path' for deb installs --- roles/0-init/tasks/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index 8eb1668eb..1bc9584a6 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -70,6 +70,11 @@ - name: Set hostname / domain (etc) in various places include_tasks: hostname.yml +- name: "Set ansible_collections_path to /usr/share/ansible/collections for deb install of ansible" + set_fact: + ansible_collections_path: /usr/share/ansible/collections + when: ansible_architecture == "i386" + - name: Add 'runtime' variable values to {{ iiab_ini_file }} ini_file: path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini From b2434f9290501a40557d03e817c1bd58d9005059 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 21 Feb 2025 11:28:59 -0600 Subject: [PATCH 15/15] move on-demand to main.yml from install.yml Could of used main.yml when the below were added https://github.com/iiab/iiab/pull/3665 https://github.com/iiab/iiab/pull/3668 --- roles/matomo/tasks/install.yml | 15 --------------- roles/matomo/tasks/main.yml | 14 ++++++++++++++ roles/mediawiki/tasks/install.yml | 15 --------------- roles/mediawiki/tasks/main.yml | 15 +++++++++++++++ roles/moodle/tasks/install.yml | 10 ---------- roles/moodle/tasks/main.yml | 14 ++++++++++++++ roles/nextcloud/tasks/install.yml | 15 --------------- roles/nextcloud/tasks/main.yml | 14 ++++++++++++++ roles/pbx/tasks/install.yml | 15 --------------- roles/pbx/tasks/main.yml | 14 ++++++++++++++ roles/wordpress/tasks/install.yml | 15 --------------- roles/wordpress/tasks/main.yml | 14 ++++++++++++++ 12 files changed, 85 insertions(+), 85 deletions(-) diff --git a/roles/matomo/tasks/install.yml b/roles/matomo/tasks/install.yml index 7de697f49..8aefcf405 100644 --- a/roles/matomo/tasks/install.yml +++ b/roles/matomo/tasks/install.yml @@ -12,21 +12,6 @@ # fatal: [127.0.0.1]: FAILED! => {"cache_control": "private, no-cache, no-store", "changed": false, "connection": "close", "content_type": "text/html; charset=utf-8", "date": "Wed, 15 Jun 2022 05:07:41 GMT", "elapsed": 0, "expires": "Thu, 19 Nov 1981 08:52:00 GMT", "msg": "Status code was 500 and not [200]: HTTP Error 500: Internal Server Error", "pragma": "no-cache", "redirected": false, "server": "nginx/1.18.0 (Ubuntu)", "set_cookie": "MATOMO_SESSID=psak3aem27vrdrt8t2f016600f; path=/; HttpOnly; SameSite=Lax", "status": 500, "transfer_encoding": "chunked", "url": "http://box.lan/matomo/index.php?action=welcome", "x_matomo_request_id": "fbfd2"} -- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" - set_fact: - mysql_install: True - mysql_enabled: True - -- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) - include_role: - name: mysql - -- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' - fail: - msg: "Matomo install cannot proceed, as MySQL / MariaDB is not installed." - when: mysql_installed is undefined - - - name: Record (initial) disk space used shell: df -B1 --output=used / | tail -1 register: df1 diff --git a/roles/matomo/tasks/main.yml b/roles/matomo/tasks/main.yml index b99de06e7..ba5001a07 100644 --- a/roles/matomo/tasks/main.yml +++ b/roles/matomo/tasks/main.yml @@ -18,6 +18,20 @@ fail_msg: "PLEASE GIVE VARIABLE 'matomo_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" quiet: yes +- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" + set_fact: + mysql_install: True + mysql_enabled: True + +- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) + include_role: + name: mysql + +- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' + fail: + msg: "Matomo install cannot proceed, as MySQL / MariaDB is not installed." + when: mysql_installed is undefined + - block: diff --git a/roles/mediawiki/tasks/install.yml b/roles/mediawiki/tasks/install.yml index 369f676eb..0ffc63cfe 100644 --- a/roles/mediawiki/tasks/install.yml +++ b/roles/mediawiki/tasks/install.yml @@ -1,18 +1,3 @@ -- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" - set_fact: - mysql_install: True - mysql_enabled: True - -- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) - include_role: - name: mysql - -- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' - fail: - msg: "MediaWiki install cannot proceed, as MySQL / MariaDB is not installed." - when: mysql_installed is undefined - - - name: Record (initial) disk space used shell: df -B1 --output=used / | tail -1 register: df1 diff --git a/roles/mediawiki/tasks/main.yml b/roles/mediawiki/tasks/main.yml index 1a0318e06..29d0b1092 100644 --- a/roles/mediawiki/tasks/main.yml +++ b/roles/mediawiki/tasks/main.yml @@ -18,6 +18,21 @@ fail_msg: "PLEASE GIVE VARIABLE 'mediawiki_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" quiet: yes +- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" + set_fact: + mysql_install: True + mysql_enabled: True + +- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) + include_role: + name: mysql + +- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' + fail: + msg: "MediaWiki install cannot proceed, as MySQL / MariaDB is not installed." + when: mysql_installed is undefined + + - block: diff --git a/roles/moodle/tasks/install.yml b/roles/moodle/tasks/install.yml index 5ec80d2dc..e5681187c 100644 --- a/roles/moodle/tasks/install.yml +++ b/roles/moodle/tasks/install.yml @@ -21,16 +21,6 @@ # sudo -u www-data /usr/bin/php admin/cli/maintenance.php --disable -- name: "Set 'postgresql_install: True' and 'postgresql_enabled: True'" - set_fact: - postgresql_install: True - postgresql_enabled: True - -- name: POSTGRESQL - run 'postgresql' role (attempt to install & enable PostgreSQL) - include_role: - name: postgresql - - - name: Record (initial) disk space used shell: df -B1 --output=used / | tail -1 register: df1 diff --git a/roles/moodle/tasks/main.yml b/roles/moodle/tasks/main.yml index aeb40556f..46af6ced4 100644 --- a/roles/moodle/tasks/main.yml +++ b/roles/moodle/tasks/main.yml @@ -18,6 +18,20 @@ fail_msg: "PLEASE GIVE VARIABLE 'moodle_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" quiet: yes +- name: "Set 'postgresql_install: True' and 'postgresql_enabled: True'" + set_fact: + postgresql_install: True + postgresql_enabled: True + +- name: POSTGRESQL - run 'postgresql' role (attempt to install & enable PostgreSQL) + include_role: + name: postgresql + +- name: FAIL (STOP THE INSTALL) IF 'postgresql_installed is undefined' + fail: + msg: "Moodle install cannot proceed, as postgresql is not installed." + when: postgresql_installed is undefined + - block: diff --git a/roles/nextcloud/tasks/install.yml b/roles/nextcloud/tasks/install.yml index 2fae98551..6a52d29c1 100644 --- a/roles/nextcloud/tasks/install.yml +++ b/roles/nextcloud/tasks/install.yml @@ -1,18 +1,3 @@ -- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" - set_fact: - mysql_install: True - mysql_enabled: True - -- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) - include_role: - name: mysql - -- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' - fail: - msg: "Nextcloud install cannot proceed, as MySQL / MariaDB is not installed." - when: mysql_installed is undefined - - - name: Record (initial) disk space used shell: df -B1 --output=used / | tail -1 register: df1 diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 1308da347..ad6214b50 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -18,6 +18,20 @@ fail_msg: "PLEASE GIVE VARIABLE 'nextcloud_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" quiet: yes +- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" + set_fact: + mysql_install: True + mysql_enabled: True + +- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) + include_role: + name: mysql + +- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' + fail: + msg: "Nextcloud install cannot proceed, as MySQL / MariaDB is not installed." + when: mysql_installed is undefined + - block: diff --git a/roles/pbx/tasks/install.yml b/roles/pbx/tasks/install.yml index 5c49dfa14..ef9dea71d 100644 --- a/roles/pbx/tasks/install.yml +++ b/roles/pbx/tasks/install.yml @@ -22,21 +22,6 @@ # when: nodejs_version != "12.x" -- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" - set_fact: - mysql_install: True - mysql_enabled: True - -- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) - include_role: - name: mysql - -- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' - fail: - msg: "PBX install cannot proceed, as MySQL / MariaDB is not installed." - when: mysql_installed is undefined - - - name: Record (initial) disk space used shell: df -B1 --output=used / | tail -1 register: df1 diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 669f05277..264e7c4ac 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -18,6 +18,20 @@ fail_msg: "PLEASE GIVE VARIABLE 'pbx_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" quiet: yes +- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" + set_fact: + mysql_install: True + mysql_enabled: True + +- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) + include_role: + name: mysql + +- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' + fail: + msg: "PBX install cannot proceed, as MySQL / MariaDB is not installed." + when: mysql_installed is undefined + - block: diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index fb4aca021..38fb08180 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -12,21 +12,6 @@ # can arise without warning when WordPress is online, since WordPress ~4.8 -- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" - set_fact: - mysql_install: True - mysql_enabled: True - -- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) - include_role: - name: mysql - -- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' - fail: - msg: "WordPress install cannot proceed, as MySQL / MariaDB is not installed." - when: mysql_installed is undefined - - - name: Record (initial) disk space used shell: df -B1 --output=used / | tail -1 register: df1 diff --git a/roles/wordpress/tasks/main.yml b/roles/wordpress/tasks/main.yml index 106343a84..6d5085583 100644 --- a/roles/wordpress/tasks/main.yml +++ b/roles/wordpress/tasks/main.yml @@ -20,6 +20,20 @@ fail_msg: "PLEASE GIVE VARIABLE 'wordpress_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml" quiet: yes +- name: "Set 'mysql_install: True' and 'mysql_enabled: True'" + set_fact: + mysql_install: True + mysql_enabled: True + +- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL / MariaDB) + include_role: + name: mysql + +- name: FAIL (STOP THE INSTALL) IF 'mysql_installed is undefined' + fail: + msg: "WordPress install cannot proceed, as MySQL / MariaDB is not installed." + when: mysql_installed is undefined + - block: