Skip to content

Instantly share code, notes, and snippets.

@mgedmin
Created January 11, 2019 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgedmin/fbbe7cc70951a5ba45d9b33867b30246 to your computer and use it in GitHub Desktop.
Save mgedmin/fbbe7cc70951a5ba45d9b33867b30246 to your computer and use it in GitHub Desktop.
mg@platonas: /tmp/experiment $ tree
.
├── roles
│   └── common
│   └── tasks
│   ├── generate_confi1g.yml
│   ├── main.yml
│   └── sync_rules.yml
└── test.yml
3 directories, 4 files
mg@platonas: /tmp/experiment $ cat test.yml
---
- hosts: localhost
gather_facts: no
roles:
- common
mg@platonas: /tmp/experiment $ cat roles/common/tasks/main.yml
---
- name: generate config for ElastAlert and systemd unit
include_tasks:
file: generate_confi1g.yml
apply:
tags:
- genconf
tags: always
- name: Sync rules for ElastAlert
include_tasks:
file: sync_rules.yml
apply:
tags:
- syncrules
tags: always
mg@platonas: /tmp/experiment $ cat roles/common/tasks/generate_confi1g.yml
---
- name: generating config
debug: msg="generating config blah blah"
mg@platonas: /tmp/experiment $ cat roles/common/tasks/sync_rules.yml
---
- name: syncing rules
debug: msg="syncing rules blah blah"
mg@platonas: /tmp/experiment $ ansible-playbook -i localhost, test.yml -t syncrules
PLAY [localhost] ***************************************************************************************************************************
TASK [common : generate config for ElastAlert and systemd unit] ****************************************************************************
included: /tmp/experiment/roles/common/tasks/generate_confi1g.yml for localhost
TASK [common : Sync rules for ElastAlert] **************************************************************************************************
included: /tmp/experiment/roles/common/tasks/sync_rules.yml for localhost
TASK [common : syncing rules] **************************************************************************************************************
ok: [localhost] => {
"msg": "syncing rules blah blah"
}
PLAY RECAP *********************************************************************************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=0
mg@platonas: /tmp/experiment $ ansible-playbook -i localhost, test.yml
PLAY [localhost] ***************************************************************************************************************************
TASK [common : generate config for ElastAlert and systemd unit] ****************************************************************************
included: /tmp/experiment/roles/common/tasks/generate_confi1g.yml for localhost
TASK [common : generating config] **********************************************************************************************************
ok: [localhost] => {
"msg": "generating config blah blah"
}
TASK [common : Sync rules for ElastAlert] **************************************************************************************************
included: /tmp/experiment/roles/common/tasks/sync_rules.yml for localhost
TASK [common : syncing rules] **************************************************************************************************************
ok: [localhost] => {
"msg": "syncing rules blah blah"
}
PLAY RECAP *********************************************************************************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment