Code Monkey home page Code Monkey logo

ansible-podman-systemd's Introduction

Catena Ansible Role: podman-systemd

Manage a rootless container orchestration with Podman and systemd services.

Role variables

podman_containers

List of Podman containers to create or remove. The state can be created or absent. Containers are actually managed by systemd that removes them after they're stopped, so started and present falls into created and stopped falls into absent. When started: yes the container will be started via systemd. When started: no the container will be in status created and not running until the related systemd service will start.

# Defaults
podman_containers: []

# Example
podman_containers:
  - name: nginx    # Podman container name
    state: created # (created|absent), default is `created`
    started: yes   # (yes|no), default is `yes`
  - name: whoami
    state: absent
    started: no

This role requires that a file named {{ item.name }}.yml will be present into the directory {{ playbook_dir }}/compose/ for each element in the podman_containers list. In the example above you need to create two playbooks: compose/whoami.yml and compose/nginx.yml. Here's an example:

# `container` is a helper that contains all the values for each element in `podman_containers` plus:
# `container.systemd`: contains the values in `podman_generate_systemd`
# `container.labels`: contains the values in `podman_container_labels`
- name: Service {{ container.name }}
  containers.podman.podman_container:
    name: "{{ container.name }}"
    state: "{{ container.state }}"
    generate_systemd: "{{ container.systemd }}"
    labels: "{{ container.labels }}"
    # https://hub.docker.com/_/nginx
    image: docker.io/library/nginx
    ports:
      - 8880:80

podman_autoupdate

Auto-update containers via systemd timer/service:

# Defaults
podman_autoupdate: yes

podman_autoupdate_timer

Set OnCalendar value in time unit following systemd.time rules.

# Defaults
podman_autoupdate_timer: "*-*-* 10:00:00"

podman_generate_systemd

Options to generate systemd unit file for containers.

Podman auto-update expects that systemd units are generated with new: yes

# Defaults
podman_generate_systemd:
  container_prefix: ""
  path: "{{ ansible_facts['user_dir'] }}/.config/systemd/user"
  restart_policy: always
  time: 10
  names: yes
  new: yes

podman_container_labels

Define labels that will be applied to all containers.

# Defaults
container_labels:
  # Enable auto-update policy
  io.containers.autoupdate: image

ansible-podman-systemd's People

Contributors

starise avatar

Stargazers

Thomas LeMarte avatar

Watchers

 avatar

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.