Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ansible provision mode for remote playbook #2283

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

afbjorklund
Copy link
Contributor

@afbjorklund afbjorklund commented Apr 15, 2024

Closes #2282

Needs docs.


lima.yaml (based on debian.yaml)

...

provision:
- mode: ansible
  playbook: playbook.yaml

inventory.yaml (auto-generated)

lima:
  hosts:
    ansible:
      ansible_connection: ssh
      ansible_host: lima-ansible
      ansible_ssh_common_args: -F /home/anders/.lima/ansible/ssh.config

playbook.yaml

- name: My first play
  hosts: all
  tasks:
   - name: Ping my hosts
     ansible.builtin.ping:

   - name: Print message
     ansible.builtin.debug:
      msg: Hello world

https://docs.ansible.com/ansible/latest/getting_started/get_started_playbook.html

INFO[0021] [hostagent] The final requirement 1 of 1 is satisfied 
INFO[0022] Waiting for ansible playbook "playbook.yaml" 
 ______________________
< PLAY [My first play] >
 ----------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

 ________________________
< TASK [Gathering Facts] >
 ------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

[WARNING]: Platform linux on host ansible is using the discovered Python
interpreter at /usr/bin/python3, but future installation of another Python
interpreter could change this. See https://docs.ansible.com/ansible/2.9/referen
ce_appendices/interpreter_discovery.html for more information.
ok: [ansible]
 ______________________
< TASK [Ping my hosts] >
 ----------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

ok: [ansible]
 ______________________
< TASK [Print message] >
 ----------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

ok: [ansible] => {
    "changed": false,
    "msg": "Hello world"
}
 ____________
< PLAY RECAP >
 ------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

ansible                    : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

INFO[0024] READY. Run `limactl shell ansible` to open the shell. 

@afbjorklund afbjorklund force-pushed the ansible branch 2 times, most recently from 830dd18 to 3faa74f Compare April 22, 2024 07:00
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additional provisioning formats beyond shell scripts
1 participant