Giter Site home page Giter Site logo

ansible-copr_reposync's Introduction

Ansible Role: ganto.copr_reposync

CI Ansible Galaxy

Setup a local package mirror of a COPR repository which is able to provide packages that will be deleted by COPR over time. It can then be served to other machines with Web server.

A synchronization job will be created as a 'oneshot' systemd service which can be executed through a (optional) systemd timer.

Requirements

This role must run on a Linux host that uses systemd and has the dnf-utils and createrepo_c packages available which is typically Fedora or CentOS 8.

Getting Started

  1. Download this role via:

    $ ansible-galaxy install ganto.copr_reposync
    
  2. Create a minimal playbook (e.g. called reposync.yml) to run this role:

    - name: Setup COPR repository mirror
      hosts: localhost
      become: True
      gather_facts: False
    
      vars_prompt:
        - name: 'copr_reposync_name'
          prompt: 'Enter COPR repository name (e.g. ganto/jo)'
          private: no
    
      roles:
        - name: ganto.copr_reposync
  3. Run this role (for example against the ganto/jo repository):

    $ ansible-playbook reposync.yml
    Enter COPR repository name (e.g. ganto/jo): ganto/jo
    
    PLAY [Setup COPR repository mirror] ************************
    ...
    

After playbook execution completed there will be a directory /var/www/html/ganto/jo that includes the package repositories for the most common distributions and releases e.g. epel-7-x86_64 with all RPMs that are part of this repository including newly generated repository metadata so that this folder than be easily used as a yum/dnf repository by itself.

There is also a systemd timer that will regularly synchronize new package builds from COPR and regenerate the repository metadata.

$ sudo systemctl list-timers
NEXT                         LEFT          LAST                         PASSED      UNIT                               ACTIVATES
Sun 2020-02-23 06:00:00 UTC  5h 31min left Sun 2020-02-23 00:00:07 UTC  28min ago   reposync@jo-epel-7-x86_64.timer    reposync@jo-epel-7-x86_64.service
Sun 2020-02-23 06:00:00 UTC  5h 31min left Sun 2020-02-23 00:00:07 UTC  28min ago   reposync@jo-epel-8-x86_64.timer    reposync@jo-epel-8-x86_64.service
Sun 2020-02-23 06:00:00 UTC  5h 31min left Sun 2020-02-23 00:00:07 UTC  28min ago   reposync@jo-fedora-30-x86_64.timer reposync@jo-fedora-30-x86_64.service
Sun 2020-02-23 06:00:00 UTC  5h 31min left Sun 2020-02-23 00:00:07 UTC  28min ago   reposync@jo-fedora-31-x86_64.timer reposync@jo-fedora-31-x86_64.service

Serving the COPR repository mirror

  1. Install and start a Web server. E.g.:

    $ sudo dnf install httpd
    $ sudo systemctl enable --run httpd
    
  2. Download the repository file for your distribution. E.g.:

    $ sudo wget -O /etc/yum.repos.d/_copr-mirror_ganto-jo.repo http://localhost/ganto/jo/ganto-jo-fedora.repo
    
  3. Now you can install every package version from the synchronized repository mirror:

    $ sudo dnf install jo-1.3
    

Development

Testing

There is a Molecule test profile that can be used to verify the basic functionality of the role. The default scenario is using the podman container driver. If you prefer docker you can select the corresponding scenario with the -s docker molecule arguments.

  1. Ensure you have the necessary dependencies installed (e.g. in a Python venv):
pip install -r molecule/podman/requirements.txt         # for podman
# or
pip install -r molecule/docker/requirements.txt         # for docker
  1. Run the test suite. When using docker, then you need to add the -s docker option. The other options in brackets are optional but useful if you need to troubleshoot issues:
molecule [-vvv] test [--destroy never][-s docker]
  1. If you used --destroy never the container will remain after the test run and can be inspected interactively via:
podman exec -it <container-id> /bin/sh                  # for podman
# or
docker exec -it <container-id> /bin/sh                  # for docker
  1. Once you're done with inspecting the instance it has to be deleted before a new test run can be started:
molecule destroy [-s docker]

License

Apache-2.0

Author Information

Changelog

The ganto.copr_reposync role was written and is maintained by:

ansible-copr_reposync's People

Contributors

dependabot[bot] avatar ganto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.