From f78c6c300016f7496ce66e7e9fccf26349fda221 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Thu, 8 Sep 2022 23:30:17 -0500 Subject: [PATCH] Fixes #501: Update some references from yum to dnf. Hopefully not breaking. --- dynamic-inventory/digitalocean/provision.yml | 2 +- first-ansible-playbook/playbook.yml | 4 ++-- nodejs-role/playbook.yml | 4 ++-- nodejs-role/roles/nodejs/tasks/main.yml | 2 +- nodejs/provisioning/playbook.yml | 6 +++--- orchestration/scripts/app.sh | 2 +- orchestration/scripts/db.sh | 6 +++--- orchestration/scripts/multi.sh | 4 ++-- security/main.yml | 8 ++++---- tests/nodejs-role.yml | 2 +- tests/nodejs.yml | 2 +- tests/security.yml | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/dynamic-inventory/digitalocean/provision.yml b/dynamic-inventory/digitalocean/provision.yml index 84f24ef7..7431e0f3 100644 --- a/dynamic-inventory/digitalocean/provision.yml +++ b/dynamic-inventory/digitalocean/provision.yml @@ -36,4 +36,4 @@ wait_for_connection: - name: Install tcpdump. - yum: name=tcpdump state=present + dnf: name=tcpdump state=present diff --git a/first-ansible-playbook/playbook.yml b/first-ansible-playbook/playbook.yml index 6294e82a..b35690d6 100644 --- a/first-ansible-playbook/playbook.yml +++ b/first-ansible-playbook/playbook.yml @@ -4,7 +4,7 @@ tasks: - name: Ensure chrony (for time synchronization) is installed. - yum: + dnf: name: chrony state: present @@ -18,5 +18,5 @@ - hosts: all become: yes tasks: - - yum: name=chrony state=present + - dnf: name=chrony state=present - service: name=chronyd state=started enabled=yes diff --git a/nodejs-role/playbook.yml b/nodejs-role/playbook.yml index 4c801e7b..679ea9c2 100644 --- a/nodejs-role/playbook.yml +++ b/nodejs-role/playbook.yml @@ -11,12 +11,12 @@ state: present - name: Install Remi repo. - yum: + dnf: name: "https://rpms.remirepo.net/enterprise/remi-release-8.rpm" state: present - name: Install EPEL repo. - yum: name=epel-release state=present + dnf: name=epel-release state=present - name: Ensure firewalld is stopped (since this is a test server). service: name=firewalld state=stopped diff --git a/nodejs-role/roles/nodejs/tasks/main.yml b/nodejs-role/roles/nodejs/tasks/main.yml index d75c982c..3e5813ff 100644 --- a/nodejs-role/roles/nodejs/tasks/main.yml +++ b/nodejs-role/roles/nodejs/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Install Node.js (npm plus all its dependencies). - yum: name=npm state=present enablerepo=epel + dnf: name=npm state=present enablerepo=epel - name: Install forever module (to run our Node.js app). npm: name=forever global=yes state=present diff --git a/nodejs/provisioning/playbook.yml b/nodejs/provisioning/playbook.yml index 30876e25..deb82db7 100644 --- a/nodejs/provisioning/playbook.yml +++ b/nodejs/provisioning/playbook.yml @@ -7,7 +7,7 @@ tasks: - name: Install EPEL repo. - yum: name=epel-release state=present + dnf: name=epel-release state=present - name: Import Remi GPG key. rpm_key: @@ -15,7 +15,7 @@ state: present - name: Install Remi repo. - yum: + dnf: name: "https://rpms.remirepo.net/enterprise/remi-release-8.rpm" state: present @@ -23,7 +23,7 @@ service: name=firewalld state=stopped - name: Install Node.js and npm. - yum: name=npm state=present enablerepo=epel + dnf: name=npm state=present enablerepo=epel - name: Install Forever (to run our Node.js app). npm: name=forever global=yes state=present diff --git a/orchestration/scripts/app.sh b/orchestration/scripts/app.sh index 4f6196dc..75b57af9 100755 --- a/orchestration/scripts/app.sh +++ b/orchestration/scripts/app.sh @@ -4,7 +4,7 @@ set -e # Configure Django on app server. -ansible app -b -m yum -a "name=python3-pip state=present" +ansible app -b -m dnf -a "name=python3-pip state=present" ansible app -b -m pip -a "executable=pip3 name=django<4 state=present" # Check Django version. diff --git a/orchestration/scripts/db.sh b/orchestration/scripts/db.sh index 947cfc36..1d86eb2a 100755 --- a/orchestration/scripts/db.sh +++ b/orchestration/scripts/db.sh @@ -4,16 +4,16 @@ set -e # Configure MySQL (MariaDB) server. -ansible db -b -m yum -a "name=mariadb-server state=present" +ansible db -b -m dnf -a "name=mariadb-server state=present" ansible db -b -m service -a "name=mariadb state=started enabled=yes" # Configure firewalld. -ansible db -b -m yum -a "name=firewalld state=present" +ansible db -b -m dnf -a "name=firewalld state=present" ansible db -b -m service -a "name=firewalld state=started enabled=yes" ansible db -b -m firewalld -a "zone=database state=present permanent=yes" ansible db -b -m firewalld -a "source=192.168.60.0/24 zone=database state=enabled permanent=yes" ansible db -b -m firewalld -a "port=3306/tcp zone=database state=enabled permanent=yes" # Configure DB user for Django. -ansible db -b -m yum -a "name=python3-PyMySQL state=present" +ansible db -b -m dnf -a "name=python3-PyMySQL state=present" ansible db -b -m mysql_user -a "name=django host=% password=12345 priv=*.*:ALL state=present" diff --git a/orchestration/scripts/multi.sh b/orchestration/scripts/multi.sh index 2574f3c2..6e3d83ff 100755 --- a/orchestration/scripts/multi.sh +++ b/orchestration/scripts/multi.sh @@ -4,10 +4,10 @@ set -e # Other commands from the book. -ansible multi -b -m yum -a "name=chrony state=present" +ansible multi -b -m dnf -a "name=chrony state=present" ansible multi -m stat -a "path=/etc/environment" ansible multi -m copy -a "src=/etc/hosts dest=/tmp/hosts" ansible multi -b -m fetch -a "src=/etc/hosts dest=/tmp" ansible multi -m file -a "dest=/tmp/test mode=644 state=directory" ansible multi -m file -a "dest=/tmp/test state=absent" -ansible multi -b -B 3600 -P 0 -a "yum -y update" +ansible multi -b -B 3600 -P 0 -a "dnf -y update" diff --git a/security/main.yml b/security/main.yml index d208f436..705b5a08 100644 --- a/security/main.yml +++ b/security/main.yml @@ -65,7 +65,7 @@ # Automating updates for RHEL systems. - name: Install dnf-automatic. - yum: + dnf: name: dnf-automatic state: present @@ -114,13 +114,13 @@ # Monitor logins and block suspect IP addresses. - name: Ensure EPEL repo is present. - yum: + dnf: name: epel-release state: present when: ansible_os_family == 'RedHat' - name: Install fail2ban (RedHat). - yum: + dnf: name: fail2ban state: present enablerepo: epel @@ -140,7 +140,7 @@ # Use SELinux (Security-Enhanced Linux). - name: Install Python SELinux library. - yum: + dnf: name: python3-libselinux state: present diff --git a/tests/nodejs-role.yml b/tests/nodejs-role.yml index 292c4394..62e57db5 100644 --- a/tests/nodejs-role.yml +++ b/tests/nodejs-role.yml @@ -3,7 +3,7 @@ tasks: - name: Install firewalld so we can disable it in the playbook. - yum: name=firewalld state=present + dnf: name=firewalld state=present # Node.js role test. - import_playbook: ../nodejs-role/playbook.yml diff --git a/tests/nodejs.yml b/tests/nodejs.yml index eb73d55f..55dcc162 100644 --- a/tests/nodejs.yml +++ b/tests/nodejs.yml @@ -3,7 +3,7 @@ tasks: - name: Install firewalld so we can disable it in the playbook. - yum: name=firewalld state=present + dnf: name=firewalld state=present # Node.js test. - import_playbook: ../nodejs/provisioning/playbook.yml diff --git a/tests/security.yml b/tests/security.yml index 3e11d7c3..3639d4f0 100644 --- a/tests/security.yml +++ b/tests/security.yml @@ -6,7 +6,7 @@ tasks: - name: Install test dependencies. - yum: + dnf: name: - python3-libselinux - python3-policycoreutils