This Playbook installs Cockpit, copies a custom configuration file, and starts the cockpit
service.
The demo illustrates:
- How Ansible Lightspeed uses the full Playbook context when generating a task.
- Uses a generic task prompt to generate applicable, accurate Ansible code based on the existing Playbook content.
- Install the VS Code extension and activate Ansible Lightspeed using resources in the getting started guide.
- If not running this example in the Ansible self-paced labs environment, create an Ansible Inventory file with a
rhel
Ansible inventory group with the corresponding Linux target host(s) details.
---
all:
children:
rhel:
hosts:
rhel-01:
ansible_host: "Your Ansible target host"
vars:
ansible_ssh_private_key_file: 'Your SSH private key file'
ansible_user: 'Your Ansible user'
ansible_host_key_checking: false
The model continues to improve and evolve with each release and generated suggestions could differ from the examples provided. Tested content is available in the corresponding solution_install_cockpit.yml
Playbook.
Run the steps below in the ./playbooks/infra/install_cockpit/demo_install_cockpit.yml Ansible Playbook.
- Used natural language prompt to generate syntactically correct Ansible Playbook task.
- Suggestion incorporated Ansible best practices and used Fully Qualified Collection Name (FQCN).
- Ansible Lightspeed used
ansible.builtin.template
module based on the.j2
file extension. - The suggestion set the file permissions, owner, and group based on Ansible best practices.
- Ansible Lightspeed used the generic
Start and enable service
prompt and the full Playbook context to infer the user needed to start thecockpit
service.
- Ansible Lightspeed used the specific values requested in the prompt.
module_defaults:
ansible.builtin.service:
enabled: true
state: started
- Ansible Lightspeed used the full Playbook context and included the
module_defaults
Playbook entry when generating a suggestion. - Note that the suggestion no longer includes
enabled: true
andstate: started
as it's already declared in themodule_defaults
section.