example file

This commit is contained in:
Klaus Zerwes 2022-09-17 09:01:15 +02:00
parent 20843e4f79
commit 614a0a4785

78
example.yml Normal file
View File

@ -0,0 +1,78 @@
---
- 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
---
# just tasks list
# named task
- name: test
apt:
name: ipsum
# named task w/ group as pitfall
- name: test
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