aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspmfox <spmfox@foxwd.com>2024-08-28 17:51:39 -0400
committerspmfox <spmfox@foxwd.com>2024-08-28 17:51:39 -0400
commit2cccdbb42ff3b7a87210bda57870a455fc54147a (patch)
tree5d17be855a5620ddcfdbc3659b22e01c4cd4970f
parent5ca4fbf2cfe781efedc7c078acaa826c6ad39b10 (diff)
removing podman collection requirement, plays are now smarter and work with localhost (default) or remote hosts
-rw-r--r--README.md1
-rw-r--r--collections/requirements.yml3
-rw-r--r--containers.yml9
-rw-r--r--host.yml11
4 files changed, 19 insertions, 5 deletions
diff --git a/README.md b/README.md
index 05ad567..3315826 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,6 @@ Quadlet files and some understanding of quadlet and/or systemd is required to us
## Usage
ansible-playbook host.yml
sudo machinectl shell containers@
- ansible-galaxy install -r collections/requirements.yml
ansible-playbook containers.yml
## Features
diff --git a/collections/requirements.yml b/collections/requirements.yml
deleted file mode 100644
index ff06a2d..0000000
--- a/collections/requirements.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-# ansible-galaxy install -r collections/requirements.yml
-collections:
- - name: containers.podman
diff --git a/containers.yml b/containers.yml
index 59de80c..c582178 100644
--- a/containers.yml
+++ b/containers.yml
@@ -1,5 +1,14 @@
- hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: Add localhost to all group if no hosts are defined
+ ansible.builtin.add_host:
+ name: localhost
+ ansible_connection: "local"
+ when: groups['all'] | length == 0
+
+- hosts: all
tasks:
- ansible.builtin.import_role:
name: "containers"
diff --git a/host.yml b/host.yml
index f2dea0a..61f9063 100644
--- a/host.yml
+++ b/host.yml
@@ -1,6 +1,15 @@
- hosts: localhost
- become: true
+ gather_facts: false
+ tasks:
+ - name: Add localhost to all group if no hosts are defined
+ ansible.builtin.add_host:
+ name: "localhost"
+ ansible_connection: "local"
+ when: groups['all'] | length == 0
+
+- hosts: all
+ become: true
tasks:
- ansible.builtin.import_role:
name: "host"