Ansible: Difference between revisions

From Halfface
Jump to navigation Jump to search
Line 19: Line 19:
     msg: "{{ item.mount }}"
     msg: "{{ item.mount }}"
   loop: "{{ ansible_mounts }}"
   loop: "{{ ansible_mounts }}"
Print a register
    - name: Print return information from the previous task
      debug:
        msg: "{{ vm_data }}"

Revision as of 08:59, 10 September 2021

ansible options

-l SUBSET, --limit SUBSET                  (further limit selected hosts to an additional pattern)
-t TAGS, --tags TAGS                       (only run plays and tasks tagged with these values)
-e EXTRA_VARS, --extra-vars EXTRA_VARS     (set additional variables as key=value or YAML/JSON, if filename prepend with @)

dont fail on errors

ignore_errors: yes

Start where you left off

ansible-playbook playbook.yml --start-at-task="install packages"

adhoc command

ansible remote.host -u ${USER}_sysadmin -a id

debug

- name: debug1
  debug:
    var: filesystem

- name: debug2
  debug:
    msg: "Template:Item.mount"
  loop: "Template:Ansible mounts"

Print a register

   - name: Print return information from the previous task
     debug:
       msg: "Template:Vm data"