Your first automation¶
This tutorial takes about fifteen minutes. You will run a Bash job, see a failure, run an Ansible playbook from Git and join two steps into a workflow. Nothing touches real servers: Ansible targets the runner itself.
You need a running Liftway (locally is fine) and a Git repository you can push to, such as a scratch project in your GitLab.
1. Run a Bash job¶
- Open Templates → Add job template and choose Bash.
-
Name it
hello-runwayand enter the script: -
Save, then press Launch.
The job page opens. The step goes pending → starting → running → successful, and Output shows both lines. Open Info to see who launched it, which executor ran it and on which runner host.
Bash runs with bash --noprofile --norc -eo pipefail: any failing command or pipeline stage fails the job.
2. See a failure on purpose¶
Create a second Bash template, expected-failure:
Launch it. The output shows About to fail and the job ends failed, because the script exited with a non-zero code. This is what a broken script looks like — useful to know before you need it.
3. Put a playbook in Git¶
Commit two files to your repository:
- name: Liftway preflight
hosts: all
gather_facts: false
tasks:
- name: Say hello
ansible.builtin.debug:
msg: "Hello from {{ inventory_hostname }}"
all:
hosts:
localhost:
ansible_connection: local
ansible_python_interpreter: "{{ ansible_playbook_python }}"
localhost with a local connection means "the runner itself": a pod in Kubernetes, your machine with make dev.
4. Connect the repository¶
- If the repository is private, first create a credential: Credentials → Add, type Git HTTPS token (or GitLab Deploy Token), with a token that has
read_repository. See Credentials. - Projects → Add project: name
playbooks, the HTTPS URL (https://gitlab.example.com/team/playbooks.git), branchmain, and the credential. - Press Sync. When it finishes, the card shows the commit, and Liftway has found
playbooks/preflight.ymlandinventories/local.yml.
5. Create the inventory¶
Inventories → Add inventory, source Project, project playbooks, path inventories/local.yml. Save, then Sync. The inventory now shows one host, localhost.
6. Create and launch the Ansible template¶
Templates → Add job template → Ansible:
| Field | Value |
|---|---|
| Name | preflight |
| Project | playbooks |
| Playbook | playbooks/preflight.yml |
| Inventory | local |
Launch it. The output shows Ansible's task lines with ok, changed and failed highlighted. Info shows the Git revision that ran and the hosts Ansible actually touched.
7. Chain the steps into a workflow¶
- Workflows → New workflow, name
first-workflow. - Add a Job template step
preflight. - Add a Job template step
hello-runway. Under Run after pickpreflightwith condition On success. - Add a third step
expected-failure, afterhello-runway. - Add a fourth step
hello-runwayagain, namedcleanup, afterexpected-failurewith On failure. - Save and Launch.
The run page draws the graph and colours each step as it changes:
expected-failure fails, cleanup runs and succeeds — and the run is still failed. A successful handler never hides the failure. Change cleanup's condition to Always and it also runs after a success.
What you have proved¶
- Liftway accepts sign-in and runs jobs
- It tells success from failure by exit code and Ansible results
- It can read your Git repository and pin a commit
- Workflows wait for dependencies and run handlers on failure
Where to go next¶
- Target real servers: Inventories and hosts and a Machine SSH credential.
- Run steps in Kubernetes with your own tools: Execution environments.
- Change cloud infrastructure safely: Terraform plan, review, apply.