Skip to content

Commit

Permalink
Fixes geerlingguy#501: Update some references from yum to dnf. Hopefu…
Browse files Browse the repository at this point in the history
…lly not breaking.
  • Loading branch information
geerlingguy committed Sep 9, 2022
1 parent c1b8c4f commit f78c6c3
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion dynamic-inventory/digitalocean/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
wait_for_connection:

- name: Install tcpdump.
yum: name=tcpdump state=present
dnf: name=tcpdump state=present
4 changes: 2 additions & 2 deletions first-ansible-playbook/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

tasks:
- name: Ensure chrony (for time synchronization) is installed.
yum:
dnf:
name: chrony
state: present

Expand All @@ -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
4 changes: 2 additions & 2 deletions nodejs-role/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nodejs-role/roles/nodejs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions nodejs/provisioning/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@

tasks:
- name: Install EPEL repo.
yum: name=epel-release state=present
dnf: name=epel-release state=present

- name: Import Remi GPG key.
rpm_key:
key: "https://rpms.remirepo.net/RPM-GPG-KEY-remi2018"
state: present

- name: Install Remi repo.
yum:
dnf:
name: "https://rpms.remirepo.net/enterprise/remi-release-8.rpm"
state: present

- name: Ensure firewalld is stopped (since this is a test server).
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
Expand Down
2 changes: 1 addition & 1 deletion orchestration/scripts/app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions orchestration/scripts/db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions orchestration/scripts/multi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 4 additions & 4 deletions security/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

# Automating updates for RHEL systems.
- name: Install dnf-automatic.
yum:
dnf:
name: dnf-automatic
state: present

Expand Down Expand Up @@ -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
Expand All @@ -140,7 +140,7 @@

# Use SELinux (Security-Enhanced Linux).
- name: Install Python SELinux library.
yum:
dnf:
name: python3-libselinux
state: present

Expand Down
2 changes: 1 addition & 1 deletion tests/nodejs-role.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

tasks:
- name: Install test dependencies.
yum:
dnf:
name:
- python3-libselinux
- python3-policycoreutils
Expand Down

0 comments on commit f78c6c3

Please sign in to comment.