-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from zerwes/improve-task-detection
Improve task detection
- Loading branch information
Showing
7 changed files
with
337 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2 smartindent nu | ||
--- | ||
name: test | ||
on: | ||
pull_request: | ||
push: | ||
schedule: | ||
- cron: "20 6 * * 5" | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: install pyyaml | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pyyaml | ||
- name: run test | ||
run: | | ||
./test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
*.pyc | ||
*.bak | ||
test*.yml | ||
xyz/ | ||
.collections/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
- name: ansible fqcn test playbook | ||
hosts: localhost | ||
gather_facts: true | ||
tasks: | ||
- name: test task 1 | ||
command: cat dog | ||
|
||
- name: test task 2 | ||
command: | ||
cmd: cat dog | ||
|
||
- name: test task 1 fqcn | ||
ansible.builtin.command: cat dog | ||
|
||
- name: test task 2 fqcn | ||
ansible.builtin.command: | ||
cmd: cat dog | ||
|
||
- name: roles | ||
collections: | ||
- 'debops.debops' | ||
- 'debops.roles01' | ||
- 'debops.roles02' | ||
- 'debops.roles03' | ||
roles: | ||
- role: bootstrap | ||
tags: | ||
- bootstrap | ||
- role: common | ||
tags: | ||
- common | ||
|
||
--- | ||
# just tasks list | ||
|
||
# named task | ||
- name: test apt unnamed | ||
apt: | ||
name: ipsum | ||
|
||
# named task w/ group as pitfall | ||
- name: test copy with group as pitfall | ||
copy: | ||
content: aaa | ||
dest: xyz | ||
group: lorem | ||
|
||
# galaxy module | ||
- name: general command os6_config | ||
os6_config: | ||
commands: "{{ dellos_general_command | default([]) }}" | ||
when: ansible_network_os == "dellemc.os6.os6" | ||
|
||
# unnamed task | ||
- file: | ||
path: /etc/apt/sources.list.d/pve-enterprise.list | ||
state: absent | ||
when: "'ox' in group_names" | ||
|
||
# unnamed fqcn | ||
- ansible.builtin.copy: | ||
src: a | ||
dest: b | ||
|
||
# named fqcn | ||
- name: lorem ipsum | ||
ansible.builtin.copy: | ||
src: lorem | ||
dest: ipsum | ||
|
||
# block | ||
- name: "configure ..." | ||
block: | ||
- name: "read ..." | ||
command: cat dog | ||
become: true | ||
check_mode: false | ||
changed_when: false | ||
register: _local_json | ||
|
||
- name: read json | ||
set_fact: | ||
current_of_local_json: "{{ _local_json.stdout | from_json }}" | ||
|
||
- name: "write {{ of_default_config }}" | ||
ansible.builtin.copy: | ||
dest: "{{ of_default_config }}" | ||
content: "{{ current_of_local_json | combine(of_local_json, recursive=true) | to_nice_json(indent=2, sort_keys=false) }}\n" | ||
notify: restart-xyz | ||
when: of_local_json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
- name: ansible fqcn test playbook | ||
hosts: localhost | ||
gather_facts: true | ||
tasks: | ||
- name: test task 1 | ||
# possible ambiguous replacement: command : ansible.builtin.command | community.ciscosmb.command | community.routeros.command | ||
ansible.builtin.command: cat dog | ||
|
||
- name: test task 2 | ||
# possible ambiguous replacement: command : ansible.builtin.command | community.ciscosmb.command | community.routeros.command | ||
ansible.builtin.command: | ||
cmd: cat dog | ||
|
||
- name: test task 1 fqcn | ||
ansible.builtin.command: cat dog | ||
|
||
- name: test task 2 fqcn | ||
ansible.builtin.command: | ||
cmd: cat dog | ||
|
||
- name: roles | ||
collections: | ||
- 'debops.debops' | ||
- 'debops.roles01' | ||
- 'debops.roles02' | ||
- 'debops.roles03' | ||
roles: | ||
- role: bootstrap | ||
tags: | ||
- bootstrap | ||
- role: common | ||
tags: | ||
- common | ||
|
||
--- | ||
# just tasks list | ||
|
||
# named task | ||
- name: test apt unnamed | ||
ansible.builtin.apt: | ||
name: ipsum | ||
|
||
# named task w/ group as pitfall | ||
- name: test copy with group as pitfall | ||
ansible.builtin.copy: | ||
content: aaa | ||
dest: xyz | ||
group: lorem | ||
|
||
# galaxy module | ||
- name: general command os6_config | ||
dellemc.os6.os6_config: | ||
commands: "{{ dellos_general_command | default([]) }}" | ||
when: ansible_network_os == "dellemc.os6.os6" | ||
|
||
# unnamed task | ||
- ansible.builtin.file: | ||
path: /etc/apt/sources.list.d/pve-enterprise.list | ||
state: absent | ||
when: "'ox' in group_names" | ||
|
||
# unnamed fqcn | ||
- ansible.builtin.copy: | ||
src: a | ||
dest: b | ||
|
||
# named fqcn | ||
- name: lorem ipsum | ||
ansible.builtin.copy: | ||
src: lorem | ||
dest: ipsum | ||
|
||
# block | ||
- name: "configure ..." | ||
block: | ||
- name: "read ..." | ||
# possible ambiguous replacement: command : ansible.builtin.command | community.ciscosmb.command | community.routeros.command | ||
ansible.builtin.command: cat dog | ||
become: true | ||
check_mode: false | ||
changed_when: false | ||
register: _local_json | ||
|
||
- name: read json | ||
ansible.builtin.set_fact: | ||
current_of_local_json: "{{ _local_json.stdout | from_json }}" | ||
|
||
- name: "write {{ of_default_config }}" | ||
ansible.builtin.copy: | ||
dest: "{{ of_default_config }}" | ||
content: "{{ current_of_local_json | combine(of_local_json, recursive=true) | to_nice_json(indent=2, sort_keys=false) }}\n" | ||
notify: restart-xyz | ||
when: of_local_json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.