feat: create a specific podman user

This commit is contained in:
Lennard Brinkhaus 2023-09-15 11:31:38 +02:00
parent 17a87b6083
commit 00ee297f52
Signed by: lennard.brinkhaus
GPG Key ID: 286421EC53998B22
5 changed files with 31 additions and 45 deletions

View File

@ -1,38 +1,6 @@
Role Name Podman Role
========= =========
A brief description of the role goes here. A role to compile a specific podman version and run it rootless.
Orientated at a Bash-Script from m-spezial.de
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -62,5 +62,3 @@
dest: /etc/profile.d/podman.sh dest: /etc/profile.d/podman.sh
content: 'PATH=$PATH:/usr/libexec/podman' content: 'PATH=$PATH:/usr/libexec/podman'
- name: Exec lingur
shell: loginctl enable-linger 1000

View File

@ -2,6 +2,8 @@
- name: Gather variables for each operating system - name: Gather variables for each operating system
include_vars: "{{ ansible_distribution | lower }}.yml" include_vars: "{{ ansible_distribution | lower }}.yml"
- include_tasks: setup_user.yml
- include_tasks: install.yml - include_tasks: install.yml
- include_tasks: systemd-services.yml - include_tasks: systemd-services.yml

15
tasks/setup_user.yml Normal file
View File

@ -0,0 +1,15 @@
- name: Setup podman user
user:
create_home: true
name: podman_rootless
shell: /bin/bash
uid: 2534
groups:
- podman_rootless
- cdrom
- floppy
- audio
- dip
- video
- plugdev
- netdev

View File

@ -1,14 +1,17 @@
- name: Setup podman-docker service - name: "Reload systemd"
systemd_service: ansible.builtin.systemd:
enabled: true
state: started
daemon_reload: true daemon_reload: true
name: podman-docker
- name: Setup podman.sock - name: Setup podman.socket
remote_user: alphyron become: yes
become_user: podman_rootless
systemd_service: systemd_service:
enabled: true enabled: true
name: podman.sock name: podman.socket
state: started state: started
scope: "user" scope: "user"
environment:
XDG_RUNTIME_DIR: /run/user/2534
- name: Exec lingur
shell: loginctl enable-linger 1000