role_podman/tasks/configuration.yml

59 lines
1.6 KiB
YAML
Raw Normal View History

2023-12-21 16:30:57 +00:00
---
# tasks file for podman
- name: Créer l'utilisateur dédié
ansible.builtin.include_role:
name: users
vars:
users:
- name: "{{ container_user }}"
comment: Dedicated Podman user ({{ container.name }})
update_password: on_create
password_lock: true
shell: /bin/bash
- name: Créer le chemin de stockage des définitions
ansible.builtin.file:
path: "{{ container_basepath }}"
state: directory
owner: "{{ container_user }}"
group: "{{ container_user }}"
mode: u=rwX,g=rwX,o=
become: true
- name: Déployer le conteneur
ansible.builtin.template:
src: podman-quadlet.container.j2
dest: "{{ container_basepath }}/{{ container_filename }}"
owner: "{{ container_user }}"
group: "{{ container_user }}"
mode: u=rw,g=rw,o=
become: true
register: deploy_container
- name: Activer le lingering
ansible.builtin.command:
cmd: "loginctl enable-linger {{ container_user }}"
creates: /var/lib/systemd/linger/{{ container_user }}
become: true
- name: Démarrer ou redémarrer le conteneur
ansible.builtin.systemd_service:
name: "{{ container_filename | replace('.container', '.service') }}"
state: "{{ 'restarted' if deploy_container.changed else 'started' }}"
enabled: true
daemon_reload: true
scope: user
become: true
become_user: "{{ container_user }}"
2024-04-18 19:26:32 +00:00
- name: Déployer la configuration de rsyslog
ansible.builtin.template:
src: templates/rsyslog.conf.j2
dest: /etc/rsyslog.d/10-podman.conf
owner: root
group: root
mode: u=rw,g=r,o=r
become: true
notify: Redémarrer rsyslog.service