lima icon indicating copy to clipboard operation
lima copied to clipboard

Support ansible provision mode for remote playbook

Open afbjorklund opened this issue 1 year ago • 0 comments

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 avatar Apr 15 '24 20:04 afbjorklund