30
loading...
This website collects cookies to deliver better user experience
- name: Initialize database
ansible.builtin.command: init_my_db with some params
creates
parameter. If the file exists, the command module will skip the initialization and report no change.- name: Initialize database
ansible.builtin.command: init_my_db with some params
args:
creates: /path/to/file/created/at/initialization.db
changed_when
task keyword.- name: Initialize backend
command:
cmd: sensu-backend init
register: init
failed_when: init.rc not in (0, 3) # 0 - OK, 3 - already initialized
changed_when: init.rc == 0
---
- hosts: localhost
gather_facts: false
tasks:
- name: Create contaier
docker_container:
# Parameter go here
$ ansible-playbook -vv playbook.yaml
ansible-playbook [core 2.11.1]
# More output here, trimmed for brevity
TASK [Create user] ******************************************************
path: /tmp/play.yaml:5 redirecting (type: modules)
ansible.builtin.docker_container to community.docker.docker_container
# More output here, trimmed for brevity
docker_container
module into ansible.builtin.docker_container
and then redirected it to the community.docker.docker_container
.ansible
Python package, making them exceptionally convenient to use.ansible.windows
collection is not certified yet? Well, neither did the blog post author, which was a “fun” problem to solve ;)