From 7240552dfc791b296e941dacebd3fffc16cb0ee7 Mon Sep 17 00:00:00 2001 From: "pulsar89.5" Date: Sun, 30 Mar 2025 06:33:27 +0200 Subject: [PATCH] feat: Add compatibility with CoreOS --- defaults/main.yml | 3 --- handlers/main.yml | 7 ++++-- meta/main.yml | 3 +++ tasks/configuration.yml | 4 ++-- tasks/installation-apt.yml | 8 +++++++ tasks/installation-atomic_container.yml | 18 ++++++++++++++ tasks/installation-service.yml | 31 +++++++++++++++++++++++++ tasks/main.yml | 16 ++++++++----- 8 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 tasks/installation-apt.yml create mode 100644 tasks/installation-atomic_container.yml create mode 100644 tasks/installation-service.yml diff --git a/defaults/main.yml b/defaults/main.yml index d3d3657..3b561ac 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,9 +1,6 @@ --- # defaults file for ansible -elbisna_prerequisites: - - pipx - elbisna_inject_packages: - netaddr - dnspython diff --git a/handlers/main.yml b/handlers/main.yml index 10b43fa..1c25482 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,6 +1,9 @@ --- # handlers file for ansible -- name: Redémarrer le système - ansible.builtin.reboot: +- name: Apply installation + ansible.builtin.command: + argv: + - /usr/bin/rpm-ostree + - apply-live become: true diff --git a/meta/main.yml b/meta/main.yml index e9e29a1..80e7d04 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -11,5 +11,8 @@ galaxy_info: - name: Debian versions: - all + - name: CoreOS + versions: + - 41 dependencies: [] diff --git a/tasks/configuration.yml b/tasks/configuration.yml index cd50c25..6f6cd96 100644 --- a/tasks/configuration.yml +++ b/tasks/configuration.yml @@ -1,7 +1,7 @@ --- # tasks file for ansible -- name: Déployer le mot de passe vault +- name: Deploy vault password ansible.builtin.copy: dest: "~{{ elbisna_user }}/.ansible_vault_passwd" content: "{{ elbisna_vault_passwd }}" @@ -12,7 +12,7 @@ become: true diff: false -- name: Déployer la configuration +- name: Deploy ansible.cfg ansible.builtin.template: src: ansible.cfg.j2 dest: "~{{ elbisna_user }}/.ansible.cfg" diff --git a/tasks/installation-apt.yml b/tasks/installation-apt.yml new file mode 100644 index 0000000..5963a66 --- /dev/null +++ b/tasks/installation-apt.yml @@ -0,0 +1,8 @@ +--- +# tasks file for ansible + +- name: Install prerequisites package + ansible.builtin.apt: + install_recommends: false + name: pipx + become: true diff --git a/tasks/installation-atomic_container.yml b/tasks/installation-atomic_container.yml new file mode 100644 index 0000000..01440cd --- /dev/null +++ b/tasks/installation-atomic_container.yml @@ -0,0 +1,18 @@ +--- +# tasks file for borgmatic + +- name: Install prerequisites package + ansible.builtin.command: + argv: + - /usr/bin/rpm-ostree + - install + - --allow-inactive + - --assumeyes + - --idempotent + - pipx + creates: /sysroot/ostree/repo/refs/heads/rpmostree/pkg/borgmatic + become: true + notify: Apply installation + +- name: Flush handlers + meta: flush_handlers diff --git a/tasks/installation-service.yml b/tasks/installation-service.yml new file mode 100644 index 0000000..a127dd2 --- /dev/null +++ b/tasks/installation-service.yml @@ -0,0 +1,31 @@ +--- +# tasks file for ansible + +- name: Install ansible + community.general.pipx: + name: ansible + state: latest + install_deps: true + become: true + environment: + PIPX_HOME: /opt/pipx + PIPX_BIN_DIR: /usr/local/bin + +- name: Inject packages + community.general.pipx: + name: ansible + inject_packages: "{{ elbisna_inject_packages }}" + state: inject + become: true + environment: + PIPX_HOME: /opt/pipx + PIPX_BIN_DIR: /usr/local/bin + +- name: Upgrade ansible + community.general.pipx: + name: ansible + state: upgrade_all + become: true + environment: + PIPX_HOME: /opt/pipx + PIPX_BIN_DIR: /usr/local/bin diff --git a/tasks/main.yml b/tasks/main.yml index 03f3e26..d6b8335 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,10 +1,14 @@ --- # tasks file for ansible -- name: Importer les tâches d'installation - tags: installation - ansible.builtin.import_tasks: installation.yml +- name: Include installation tasks + ansible.builtin.include_tasks: + file: installation-{{ ansible_facts['pkg_mgr'] }}.yml -- name: Importer les tâches de configuration - tags: configuration - ansible.builtin.import_tasks: configuration.yml +- name: Import pipx installation tasks + ansible.builtin.import_tasks: + file: installation-service.yml + +- name: Import configuration tasks + ansible.builtin.import_tasks: + file: configuration.yml