ansible-fqcn-converter/exampleconverted.yml
2023-10-15 21:06:24 +02:00

146 lines
3.1 KiB
YAML

---
- name: ansible fqcn test playbook
hosts: localhost
gather_facts: true
vars:
xyz: abc
num: 1
deploy: true
domain: example.com
tasks:
- name: test task 1
ansible.builtin.command: cat dog
- name: test task 2
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: assert
ansible.builtin.assert:
that: true
- ansible.builtin.assert:
that: not false
- 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"
# this will be ignored due to cfg
- name: general command os10_config
os10_config:
commands: "{{ dellos_general_command | default([]) }}"
# 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
# issue #11 check double colon
- name: update mysql root password for all root accounts
community.mysql.mysql_user:
name: root
host: "{{ item }}"
password: "{{ mysql_root_password }}"
with_items:
- "{{ inventory_hostname_short }}"
- 127.0.0.1
- ::1
ignore_errors: true
run_once: true
# block
- name: "configure ..."
block:
- name: "read ..."
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
- name: test user ... expect buildin
ansible.builtin.user:
name: test
password: '!'
- name: test issue 18
ansible.builtin.command: echo "expect no openstack.cloud.config:system:set here"
with_items:
- app:disable dashboard
- config:system:set a b
- no:such:xxx
- name: test issue 22 - systemd
ansible.builtin.systemd_service:
name: systemd-timesyncd
enabled: false
state: stopped
masked: true
- name: test issue 22 - systemd_service
ansible.builtin.systemd_service:
name: systemd-timesyncd
enabled: false
state: stopped
masked: true