For Pulp 2.x, I use this plus some extra commands:
https://docs.ansible.com/ansible/latest/modules/pulp_repo_module.html

On Tue, Apr 9, 2019 at 9:48 AM Juan Cabrera <[email protected]> wrote:

> Hi,
>
> Is there an ansible module to add or remove a rpm repository ?
>
> I send in attachment the scripts I use for the moment to create and remove
> the rpm repositories.
>
> I use this:
>
> vars:
>
>    - pulp_repos:
>       - repo: epel_ptci
>         remote: epel
>         remote_url: https://epel.mirror.it2go.eu/7/x86_64/
>         state: present
>
> TODO: to become idempotent, check if repo already exists
>
> - name: config | Add repositories.
>   command: ~/create_repo --repo "{{ item.repo }}" --remote "{{ item.remote
> }}" --href "{{ item.remote_url }}"
>   loop: "{{ pulp_repos }}"
>   when: item.state is not defined or item.state == 'present'
>   become: yes
>   become_user: "{{ pulp_repo_user }}"
>
>
> - name: config | Remove repositories
>   command: ~/remove_repo --repo "{{ item.repo }}" --remote "{{ item.remote
> }}"
>   loop: "{{ pulp_repos }}"
>   when: item.state is defined and item.state == 'absent'
>   become: yes
>   become_user: "{{ pulp_repo_user }}"
>
> What is the best way to check if a repo already exist?
>
> Juan
> --
>
> Juan CABRERA
> Correspondant informatique
> Département de Mathématiques
>
> T. 081724919
> [email protected]
> http://staff.unamur.be/jbcabrer
>
> Université de Namur ASBL
> Rue de Bruxelles 61 - 5000 Namur
> Belgique
>
> Let’s respect the environment together.
> Only print this message if necessary!
> _______________________________________________
> Pulp-list mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/pulp-list
_______________________________________________
Pulp-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/pulp-list

Reply via email to