Git Product home page Git Product logo

ansible-role-podman_systemd's Introduction

Ansible Role Podman Systemd

lint quality license

Configure podman pod and container systemd untis

Role Variables

podman_systemd_service_path: /etc/systemd/system
podman_systemd_container_service_prefix: "container"
podman_systemd_pod_service_prefix: "pod"

The location where systemd service files should be instead. You can also configure the prefix of the service name.

podman_systemd_default_wants: network.target
podman_systemd_default_after: network-online.target
podman_systemd_default_restart: on-failure
podman_systemd_default_wantedby: multi-user.target default.target

The default values for systemd services. You can also change those values for each pod / container (see below).

podman_systemd_default_container_detached: false

Containers start attached by default so you can catch the output in the syslog. If you want do detach them, change to true. This can be changed for each pod / container (see below).

All other variables can be found in defaults/main.yml

Caveats

While this role theoretically supports to run a rootless container or pod with a "non main user group" (e.g. user "test" and group "asdf" instead of group "test") there might be some caveats with subuids/gids in such a constellation.

Example container variable

podman_containers:
  - name: nginx
    run_as_user: root
    run_args:
      -p 80:80
    image: nginx:latest
  - name: node-exporter
    run_as_user: prometheus
    run_args:
      -p 9100:9100
    image: quay.io/prometheus/node-exporter:v1.0.1

Example pod variable

podman_pods:
  - name: nextcloud
    run_as_user: nextcloud
    run_user_subid: 500000:100000
    run_args:
      -p 8080:80
    restart: always
    containers:
      - name: db
        image: mariadb
        detached: true
        run_args:
          -v nextcloud-db:/var/lib/mysql
          -e MYSQL_ROOT_PASSWORD=rootpw
          -e MYSQL_PASSWORD=123
          -e MYSQL_DATABASE=nextcloud
          -e MYSQL_USER=nextcloud
        cmd_args:
          --transaction-isolation=READ-COMMITTED
          --binlog-format=ROW
      - name: app
        image: nextcloud
        run_args:
          -v nextcloud-app:/var/www/html
          -e MYSQL_ROOT_PASSWORD=rootpw
          -e MYSQL_PASSWORD=123
          -e MYSQL_DATABASE=nextcloud
          -e MYSQL_USER=nextcloud

License

MIT

ansible-role-podman_systemd's People

Contributors

rxcket avatar tabic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ansible-role-podman_systemd's Issues

Role should not create/change users/groups on the system by default

This issue is regarding the "{{ type }} '{{ item.name }}' - Add group '{{ run_as_group }}'" and "{{ type }} '{{ item.name }}' - Add user '{{ run_as_user }}'" tasks located in tasks/common/prepare-rootless.yml

In my opinion, a Podman role should not create arbitrary system users at all -- or at least not by default. Also for my setup, I would not want this to override existing users. Maybe it makes sense to add when: create_groups | bool and when: create_users | bool (or something similar) to the two tasks, respectively, and then set the default for both of those variables to false?

Thanks for creating this role! This is really useful, as the podman_container module unfortunately does not have a good way of creating containers that start at boot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.