Skip to content

aptly role getting "ERROR: mkdir $HOME: permission denied" in aptly calls in tasks/repositories.yml #481

@timblaktu

Description

@timblaktu

When running the aptly role I am getting "ERROR: mkdir $HOME: permission denied" in the aptly repo list and aptly repo create calls made in tasks/repositories.yml.

I am able to ssh into the controlled aptly server as the aptly user and run the same commands, without su, successfully. I believe the problem is the su commands used to execute aptly commands.

I am using manala_aptly_user: aptly and I get the same error with and without running the role with become: true.

There is no instruction in the role docs for what ansible user to run as, and there are runtime warnings about the su call:

[WARNING]: Consider using 'become', 'become_method', and 'become_user' rather than running su

How am I supposed to get past this user issue? Here is how my playbook invokes your role:

- name: Install/Configure Aptly                                                                                                                                                     
  tags: ["install", "aptly"]                                                                                                                                                        
  # become: true                                                                                                                                                                    
  hosts: aptly_server                                                                                                                                                               
  vars:                                                                                                                                                                               
    manala_aptly_user: aptly                                                                                                                                                          
    manala_aptly_config_file: "/home/{{ manala_aptly_user }}/.aptly.conf"                                                                                                             
    manala_aptly_config_template: ../files/aptly_config_template.j2                                                                                                                   
    manala_aptly_repositories:                                                                                                                                                          
      - name: b-stretch  # Name for Aptly Local Repo                                                                                                                                  
        comment: \"Packages for Debian Stretch\"  # Description for Aptly Local Repo, must include quotes if contains spaces (role bug)                                             
        component: main  # e.g. main contrib non-free                                                                                                                                     
        distribution: stretch  # becomes a subdirectory in $ARCHIVE_ROOT/dists. Synonym for suite or codename in different contexts.                                                      
  roles:                                                                                                                                                                              
    - role: manala.aptly

I'm using role version 2.0.2 and ansible version 2.9.10:

ansible 2.9.10
config file = /home/tblack/src/cm/ansible/projects/aptly/ansible.cfg
configured module search path = ['/home/tblack/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/tblack/.local/lib/python3.8/site-packages/ansible
executable location = /home/tblack/.local/bin/ansible
python version = 3.8.3 (default, Jun 30 2020, 11:18:52) [GCC 6.3.0 20170516]

Thanks for your time!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions