---

# Installation tasks

- name : Import aptly GPG key
  become : True
  apt_key :
    id : "{{ aptly_gpg_key }}"
    keyserver : "{{ aptly_gpg_keyserver }}"
    state : 'present'

- name : Install aptly repository
  become : True
  apt_repository :
    repo : "{{ aptly_repository }}"
    update_cache : True
    state : 'present'

- name : Create aptly user
  become : True
  user :
    name : "{{ aptly_user }}"
    comment : 'User for aptly repository management'
    home : "{{ aptly_user_home }}"
    shell : '/bin/bash'
    uid: "{{ aptly_uid | default(omit) }}"

- name : Change home permission
  become : True
  file :
    dest : "{{ aptly_user_home }}"
    mode : '0700'

- name : Install aptly package
  become : True
  apt :
    name : "{{ item }}"
    cache_valid_time : 3600
    update_cache : True
    state : 'present'
  with_items: "{{ aptly_packages }}"


---

# Installation tasks

- name : Import aptly GPG key
  become : True
  apt_key :
    id : "{{ aptly_gpg_key }}"
    keyserver : "{{ aptly_gpg_keyserver }}"
    state : 'present'

- name : Install aptly repository
  become : True
  apt_repository :
    repo : "{{ aptly_repository }}"
    update_cache : True
    state : 'present'

- name: Ensure aptly group
  become : True
  group:
    name: "{{ aptly_group }}"
    gid: "{{ aptly_gid | default(omit) }}"

- name : Ensure aptly user
  become : True
  user :
    name : "{{ aptly_user }}"
    comment : 'User for aptly repository management'
    home : "{{ aptly_user_home }}"
    group: "{{ aptly_group }}"
    shell : '/bin/bash'
    uid: "{{ aptly_uid | default(omit) }}"

- name : Change home permission
  become : True
  file :
    dest : "{{ aptly_user_home }}"
    mode : '0700'

- name : Install aptly package
  become : True
  apt :
    name : "{{ item }}"
    cache_valid_time : 3600
    update_cache : True
    state : 'present'
  with_items: "{{ aptly_packages }}"


Use aptly_group when creating aptly user.
Use aptly_group when creating aptly user.

This commit makes sure the aptly user creation can define a primary
group for aptly, which defaults to "aptly".
