Ansible VSFTPD Issue - Cannot get repository working

I am configuring a vsftpd repository on a server, and pointing my clients to it. This is from the Sander Van Vugt RHEL study exam and I cannot get the vsftpd part working. I can do the HTTP one, but for some reason VSFTPD doesn’t work as expected.

This part is done on the repository server. And below this I will post what I’m doing to point the clients at this repository server.

  • name: Setup repo server
    hosts: localhost
    become: true
    become_user: root
    ignore_errors: true
    tasks:

    • name: Create /var/ftp/repo
      file:
      path: /var/ftp/repo
      state: directory

    • name: Loop mount /dev/sr0 on /var/ftp/repo
      command: mount /dev/sr0 /var/ftp/repo -t iso9660 -o “loop,context=system_u:object_r:public_content_t:s0,nofail”

    • name: Update fstab
      lineinfile:
      path: /etc/fstab
      insertafter: eof
      line: “/dev/sr0 /var/ftp/repo iso9660 loop,context=system_u:object_r:public_content_t:s0,nofail”

    • name: Disable firewalld service
      service:
      name: firewalld
      state: stopped

    • name: Install vsftpd package
      dnf:
      name: vsftpd
      state: latest

    • name: Enable vsftpd service
      service:
      name: vsftpd
      state: started
      enabled: true

    • name: Allow listening for vsftpd
      lineinfile:
      path: /etc/vsftpd/vsftpd.conf
      insertafter: eof
      line: “listen=YES”

    • name: Disable listening
      lineinfile:
      path: /etc/vsftpd/vsftpd.conf
      regexp: “^listen=NO”
      line: “”

    • name: Allow anon_root to /var/ftp/repo
      lineinfile:
      path: /etc/vsftpd/vsftpd.conf
      insertafter: eof
      line: “anon_root=/var/ftp/repo”

    • name: Allow anonymous user access to /var/ftp/repo
      lineinfile:
      path: /etc/vsftpd/vsftpd.conf
      regexp: “^anonymous_enable”
      line: “anonymouns_enable=YES”

    • name: Disable SELinux
      ansible.posix.selinux:
      state: disabled

This part is done on the clients


  • name: Setup clients to use repo
    hosts: all
    become: true
    become_user: root
    ignore_errors: true
    tasks:

    • name: Update hosts file
      lineinfile:
      path: /etc/hosts
      insertafter: eof
      line: “10.0.10.10 ct”

    • name: Replace old repos
      replace:
      path: /etc/yum.repos.d/redhat.repo
      regexp: “^enabled = 1”
      replace: “enabled = 0”

    • name: Enable access to new repo BaseOS
      yum_repository:
      name: Custom_BaseOS
      description: Custom_BaseOS
      baseurl: ftp://ct.shaneshomelab.com/BaseOS
      gpgcheck: no

    • name: Enable access to new repo AppStream
      yum_repository:
      name: Custom_AppStream
      description: Custom_AppStream
      baseurl: ftp://ct.shaneshomelab.com/AppStream
      gpgcheck: no

Any ideas on how to tackle this? I really don’t know what is going on with VSFTPD
I cannot curl it either. I have completely disabled selinux

When I do a dnf repolist and dnf update I get this

[awx@VM1 ~]$ sudo dnf repolist
[sudo] password for awx:
Updating Subscription Management repositories.
repo id repo name
Custom_AppStream Custom_AppStream
Custom_BaseOS Custom_BaseOS
Errors during downloading metadata for repository ‘Custom_AppStream’:

  • Curl error (67): Login denied for URL (can’t put here) [Access denied: 530]
    Error: Failed to download metadata for repo ‘Custom_AppStream’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

[awx@VM1 ~]$ curl url^C
[awx@VM1 ~]$ curl url (can’t put here or it tells me I cant post)
curl: (67) Access denied: 530

misspelled?

lineinfile:
  path: /etc/vsftpd/vsftpd.conf
  regexp: "^anonymous_enable"
  line: "anonymous_enable=YES"

Wow I’m an idiot
Yes that was it lol

I do get a bunch of these errors, but maybe they can be ignored? lol

[awx@VM1 ~]$ sudo dnf update
Updating Subscription Management repositories.
Last metadata expiration check: 0:01:18 ago on Mon 03 Mar 2025 01:25:00 PM CST.
Modular dependency problems:

Problem 1: conflicting requests

  • nothing provides module(platform:el8) needed by module ant:1.10:8100020240221104459:417e5c08.x86_64 from Custom_AppStream
    Problem 2: conflicting requests
  • nothing provides module(platform:el8) needed by module container-tools:rhel8:8100020240227110532:82888897.x86_64 from Custom_AppStream
    Problem 3: conflicting requests
  • nothing provides module(platform:el8) needed by module eclipse:rhel8:8030020201023061315:498c0fee.x86_64 from Custom_AppStream
    Problem 4: conflicting requests
  • nothing provides module(platform:el8) needed by module freeradius:3.0:8080020221214103624:89170a74.x86_64 from Custom_AppStream
    Problem 5: conflicting requests
  • nothing provides module(platform:el8) needed by module gimp:2.8:8090020240201075404:4ba4a31a.x86_64 from Custom_AppStream
    Problem 6: conflicting requests
  • nothing provides module(platform:el8) needed by module go-toolset:rhel8:8100020240401160413:7e2b282f.x86_64 from Custom_AppStream
    Problem 7: conflicting requests
  • nothing provides module(platform:el8) needed by module httpd:2.4:8100020240405103607:e155f54d.x86_64 from Custom_AppStream
    Problem 8: conflicting requests
  • nothing provides module(platform:el8) needed by module idm:client:8100020240307184541:6d180cd9.x86_64 from Custom_AppStream
    Problem 9: conflicting requests
  • nothing provides module(platform:el8) needed by module inkscape:0.92.3:8080020221109110104:3e031279.x86_64 from Custom_AppStream
    Problem 10: conflicting requests
  • nothing provides module(platform:el8) needed by module jaxb:4:8080020230207081414:9d367344.x86_64 from Custom_AppStream
    Problem 11: conflicting requests
  • nothing provides module(platform:el8) needed by module jmc:rhel8:8050020211005144542:6392b1f8.x86_64 from Custom_AppStream
    Problem 12: conflicting requests
  • nothing provides module(platform:el8) needed by module llvm-toolset:rhel8:8100020240205133135:e155f54d.x86_64 from Custom_AppStream
    Problem 13: conflicting requests
  • nothing provides module(platform:el8) needed by module log4j:2:8080020221020123337:9d367344.x86_64 from Custom_AppStream
    Problem 14: conflicting requests
  • nothing provides module(platform:el8) needed by module mailman:2.1:8090020230727085757:0ef2f6ef.x86_64 from Custom_AppStream
    Problem 15: conflicting requests
  • nothing provides module(platform:el8) needed by module mariadb:10.3:8080020230814130040:63b34585.x86_64 from Custom_AppStream
    Problem 16: conflicting requests
  • nothing provides module(platform:el8) needed by module maven:3.5:8060020220428102527:219351c9.x86_64 from Custom_AppStream
    Problem 17: conflicting requests
  • nothing provides module(platform:el8) needed by module mercurial:4.8:820190108205035:77fc8825.x86_64 from Custom_AppStream
    Problem 18: conflicting requests
  • nothing provides module(platform:el8) needed by module mod_auth_openidc:2.3:8090020230721123832:b46abd14.x86_64 from Custom_AppStream
    Problem 19: conflicting requests
  • nothing provides module(platform:el8) needed by module mysql:8.0:8090020240126173013:a75119d5.x86_64 from Custom_AppStream
    Problem 20: conflicting requests
  • nothing provides module(platform:el8) needed by module nginx:1.14:8000020190830002848:f8e95b4e.x86_64 from Custom_AppStream
    Problem 21: conflicting requests
  • nothing provides module(platform:el8) needed by module nodejs:10:8030020210225164533:229f0a1c.x86_64 from Custom_AppStream
    Problem 22: conflicting requests
  • nothing provides module(platform:el8) needed by module perl:5.26:820181219174508:9edba152.x86_64 from Custom_AppStream
    Problem 23: conflicting requests
  • nothing provides module(platform:el8) needed by module php:7.2:8020020191108065827:2c7ca891.x86_64 from Custom_AppStream
    Problem 24: conflicting requests
  • nothing provides module(platform:el8) needed by module postgresql:10:8090020240213200157:a75119d5.x86_64 from Custom_AppStream
    Problem 25: conflicting requests
  • nothing provides module(platform:el8) needed by module python27:2.7:8100020240208011952:5f0f67de.x86_64 from Custom_AppStream
    Problem 26: conflicting requests
  • nothing provides module(platform:el8) needed by module python36:3.6:8100020231207164005:5ae887d0.x86_64 from Custom_AppStream
    Problem 27: conflicting requests
  • nothing provides module(platform:el8) needed by module python38:3.8:8090020230810143931:d9f72c26.x86_64 from Custom_AppStream
    Problem 28: conflicting requests
  • nothing provides module(platform:el8) needed by module python39:3.9:8100020240214182535:7044f6c1.x86_64 from Custom_AppStream
    Problem 29: conflicting requests
  • nothing provides module(platform:el8) needed by module redis:5:8040020211011074037:522a0ee4.x86_64 from Custom_AppStream
    Problem 30: conflicting requests
  • nothing provides module(platform:el8) needed by module rhn-tools:1.0:8010020190425142954:f69d1239.x86_64 from Custom_AppStream
    Problem 31: conflicting requests
  • nothing provides module(platform:el8) needed by module ruby:2.5:8090020230627084142:b46abd14.x86_64 from Custom_AppStream
    Problem 32: conflicting requests
  • nothing provides module(platform:el8) needed by module rust-toolset:rhel8:8100020240119204620:f4e2ccb8.x86_64 from Custom_AppStream
    Problem 33: conflicting requests
  • nothing provides module(platform:el8) needed by module satellite-5-client:1.0:8010020190621091459:cdc1202b.x86_64 from Custom_AppStream
    Problem 34: conflicting requests
  • nothing provides module(platform:el8) needed by module squid:4:8100020240319173245:e155f54d.x86_64 from Custom_AppStream
    Problem 35: conflicting requests
  • nothing provides module(platform:el8) needed by module subversion:1.10:8070020220701055908:78111232.x86_64 from Custom_AppStream
    Problem 36: conflicting requests
  • nothing provides module(platform:el8) needed by module swig:3.0:8030020200407110056:30b713e6.x86_64 from Custom_AppStream
    Problem 37: conflicting requests
  • nothing provides module(platform:el8) needed by module varnish:6:8090020240328195416:a75119d5.x86_64 from Custom_AppStream
    Problem 38: conflicting requests
  • nothing provides module(platform:el8) needed by module virt:rhel:8100020240314161907:e155f54d.x86_64 from Custom_AppStream
    Problem 39: cannot install the best candidate for the job
  • nothing provides module(platform:el8) needed by module perl-libwww-perl:6.34:8060020210901111951:5e590cab.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-libwww-perl:6.34:8060020210901111951:9168a43d.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-libwww-perl:6.34:8060020210901111951:b947e2fe.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-libwww-perl:6.34:8060020210901111951:e0b4ded3.x86_64 from Custom_AppStream
    Problem 40: cannot install the best candidate for the job
  • nothing provides module(platform:el8) needed by module perl-YAML:1.24:8060020210901112033:369bdfc6.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-YAML:1.24:8060020210901112033:6a1d53c5.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-YAML:1.24:8060020210901112033:e4fef011.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-YAML:1.24:8060020210901112033:f7485d8d.x86_64 from Custom_AppStream
    Problem 41: cannot install the best candidate for the job
  • nothing provides module(platform:el8) needed by module perl-IO-Socket-SSL:2.066:8060020211122104554:03d935ed.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-IO-Socket-SSL:2.066:8060020211122104554:0e56aea9.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-IO-Socket-SSL:2.066:8060020211122104554:200e0407.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-IO-Socket-SSL:2.066:8060020211122104554:bc93984d.x86_64 from Custom_AppStream
    Problem 42: cannot install the best candidate for the job
  • nothing provides module(platform:el8) needed by module perl-FCGI:0.78:8060020210901110348:03d935ed.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-FCGI:0.78:8060020210901110348:0e56aea9.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-FCGI:0.78:8060020210901110348:200e0407.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-FCGI:0.78:8060020210901110348:bc93984d.x86_64 from Custom_AppStream
    Problem 43: cannot install the best candidate for the job
  • nothing provides module(platform:el8) needed by module perl-DBI:1.641:8060020211122100623:03d935ed.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBI:1.641:8060020211122100623:0e56aea9.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBI:1.641:8060020211122100623:200e0407.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBI:1.641:8060020211122100623:bc93984d.x86_64 from Custom_AppStream
    Problem 44: cannot install the best candidate for the job
  • nothing provides module(platform:el8) needed by module perl-DBD-SQLite:1.58:8060020210901111154:0c8a95f7.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBD-SQLite:1.58:8060020210901111154:4f86f5e0.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBD-SQLite:1.58:8060020210901111154:a201e4c2.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBD-SQLite:1.58:8060020210901111154:bce9b2db.x86_64 from Custom_AppStream
    Problem 45: cannot install the best candidate for the job
  • nothing provides module(platform:el8) needed by module perl-DBD-Pg:3.7:8060020210901112417:66cd6814.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBD-Pg:3.7:8060020210901112417:c5552f1b.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBD-Pg:3.7:8060020210901112417:e46b129e.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBD-Pg:3.7:8060020210901112417:e5d39b47.x86_64 from Custom_AppStream
    Problem 46: cannot install the best candidate for the job
  • nothing provides module(platform:el8) needed by module perl-DBD-MySQL:4.046:8060020210901110310:0c8a95f7.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBD-MySQL:4.046:8060020210901110310:4f86f5e0.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBD-MySQL:4.046:8060020210901110310:a201e4c2.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-DBD-MySQL:4.046:8060020210901110310:bce9b2db.x86_64 from Custom_AppStream
    Problem 47: cannot install the best candidate for the job
  • nothing provides module(platform:el8) needed by module perl-App-cpanminus:1.7044:8060020211122110049:2e584954.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-App-cpanminus:1.7044:8060020211122110049:5c1672a6.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-App-cpanminus:1.7044:8060020211122110049:7ba85dc7.x86_64 from Custom_AppStream
  • nothing provides module(platform:el8) needed by module perl-App-cpanminus:1.7044:8060020211122110049:a439c6c3.x86_64 from Custom_AppStream

The errors indicate that various module streams require “module(platform:el8)” which is not available in your repository’s metadata. This leads to conflicting requests when DNF attempts to resolve dependencies.

Do I need to worry about that for the exam?
Is there a better way to do what I’m trying to do?

Is there anything I’m missing here? I cannot download any packages…

[awx@VM1 ~]$ curl ftp://ct.shaneshomelab.com
drwxr-xr-x 1 0 0 2048 Oct 09 08:22 AppStream
drwxr-xr-x 1 0 0 2048 Oct 09 08:22 BaseOS
drwxrwxr-x 1 0 0 2048 Oct 07 15:23 EFI
-r–r–r-- 1 0 0 8154 Oct 09 08:07 EULA
-r–r–r-- 1 0 0 18092 Oct 09 08:07 GPL
-r–r–r-- 1 0 0 1669 Oct 09 08:07 RPM-GPG-KEY-redhat-beta
-r–r–r-- 1 0 0 3682 Oct 09 08:07 RPM-GPG-KEY-redhat-release
-r–r–r-- 1 0 0 1455 Oct 09 08:33 extra_files.json
drwxrwxr-x 1 0 0 2048 Oct 07 15:23 images
drwxrwxr-x 1 0 0 2048 Oct 07 15:23 isolinux
-r–r–r-- 1 0 0 103 Oct 09 08:22 media.repo

I can curl it but it doesn’t let me download packages?

FTP can be tricky with active vs. passive modes. Although firewalld is disabled in your setup, ensure that vsftpd is set up for passive mode if your clients expect it. You can add (or verify) these settings in /etc/vsftpd/vsftpd.conf

pasv_enable=YES
pasv_min_port=30000
pasv_max_port=31000

I tried that and same thing, even after restarting service. Hmmm

There are a few things to go over. First, you shouldn’t use “ignore_errors: true” unless you have a specific reason to do so. In the playbook you posted, you are also configuring vsftpd after starting it. In order for vsftpd to use the configuration you’re writing you have to modify the config file before you start it. Ensure the repo you’re creating is for the same version the clients are using.

Try to do the configuration by hand before you automate. It’s important to know how to get things working manually, before automating. Also, although you should keep SELinux on, if you do need it out of the way while troubleshooting, set it to permissive, instead of disabling it.