-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example of ansible provisioning with playbook
Currently the playbook is relative to the current workdir, it should probably be relative to the lima.yaml instead. Signed-off-by: Anders F Björklund <[email protected]>
- Loading branch information
1 parent
16fd466
commit 100be8b
Showing
6 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This template requires Lima v0.7.0 or later. | ||
images: | ||
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months. | ||
- location: "https://cloud-images.ubuntu.com/releases/24.04/release-20240821/ubuntu-24.04-server-cloudimg-amd64.img" | ||
arch: "x86_64" | ||
digest: "sha256:0e25ca6ee9f08ec5d4f9910054b66ae7163c6152e81a3e67689d89bd6e4dfa69" | ||
- location: "https://cloud-images.ubuntu.com/releases/24.04/release-20240821/ubuntu-24.04-server-cloudimg-arm64.img" | ||
arch: "aarch64" | ||
digest: "sha256:5ecac6447be66a164626744a87a27fd4e6c6606dc683e0a233870af63df4276a" | ||
# Fallback to the latest release image. | ||
# Hint: run `limactl prune` to invalidate the cache | ||
- location: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img" | ||
arch: "x86_64" | ||
- location: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-arm64.img" | ||
arch: "aarch64" | ||
|
||
mounts: | ||
- location: "~" | ||
- location: "/tmp/lima" | ||
writable: true | ||
|
||
provision: | ||
- mode: ansible | ||
playbook: ./templates/ansible/playbook.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Ansible | ||
|
||
Playbook example from: | ||
|
||
<https://docs.ansible.com/ansible/latest/getting_started/get_started_playbook.html> | ||
|
||
Template example from: | ||
|
||
<https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_templating.html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- name: My first play | ||
hosts: all | ||
tasks: | ||
- name: Ping my hosts | ||
ansible.builtin.ping: | ||
|
||
- name: Print message | ||
ansible.builtin.debug: | ||
msg: Hello world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Write hostname | ||
hosts: all | ||
tasks: | ||
- name: write hostname using jinja2 | ||
ansible.builtin.template: | ||
src: templates/test.j2 | ||
dest: /tmp/hostname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
My name is {{ ansible_facts['hostname'] }} |