---
- name: Get rhpkg Fedora repository
  copy:
    dest: /etc/yum.repos.d/rhpkg.repo
    mode: 0644
    owner: root
    group: root
    # retrieved from http://download.devel.redhat.com/rel-eng/dist-git/fedora/rhpkg.repo 2016-10-21
    content: |
      [rhpkg]
      name=rhpkg for Fedora $releasever
      baseurl=http://download.lab.bos.redhat.com/rel-eng/dist-git/fedora/$releasever/
      enabled=1
      gpgcheck=0

- name: Get brew/koji Fedora repository
  copy:
    dest: /etc/yum.repos.d/brew.repo
    mode: 0644
    owner: root
    group: root
    # retrieved from http://download.devel.redhat.com/rel-eng/brew/fedora/brew.repo 2016-10-21
    content: |
      [brew]
      name=Brew Buildsystem for Fedora $releasever - $basearch
      baseurl=http://download.devel.redhat.com/rel-eng/brew/fedora/$releasever/
      enabled=1
      gpgcheck=0

- name: Install rhpkg/brew tools for Fedora and RHEL packaging
  dnf: name={{ item }} state=latest
  with_items:
    - rhpkg
    - brew
    - fedpkg
    - koji
  tags:
    - packages

---
- name: Get rhpkg Fedora repository
  copy:
    dest: /etc/yum.repos.d/rhpkg.repo
    mode: 0644
    owner: root
    group: root
    # retrieved from http://download.devel.redhat.com/rel-eng/dist-git/fedora/rhpkg.repo 2016-10-21
    content: |
      [rhpkg]
      name=rhpkg for Fedora $releasever
      baseurl=http://download.lab.bos.redhat.com/rel-eng/dist-git/fedora/$releasever/
      enabled=1
      gpgcheck=0

- name: Get brew/koji Fedora repository
  copy:
    dest: /etc/yum.repos.d/brew.repo
    mode: 0644
    owner: root
    group: root
    # retrieved from http://download.devel.redhat.com/rel-eng/brew/fedora/brew.repo 2016-10-21
    content: |
      [brew]
      name=Brew Buildsystem for Fedora $releasever - $basearch
      baseurl=http://download.devel.redhat.com/rel-eng/brew/fedora/$releasever/
      enabled=1
      gpgcheck=0

- name: Install rhpkg/brew tools for Fedora and RHEL packaging
  dnf: name={{ item }} state=latest
  with_items:
    - rhpkg
    - brewkoji
    - fedpkg
    - koji
  tags:
    - packages

# get current groups first to avoid overwriting memberships
- command: groups
  become_user: ryansb
  changed_when: false
  register: current_groups
- user: name=ryansb group=ryansb groups='{{ current_groups.stdout.split(" ")[1:] | join(",") }},mock'

Check current groups before adding self to mock group
Check current groups before adding self to mock group
