Рубрики
ansible

ansible переменные / Debug / Set_fact / Register

host.txt


ansible all -m setup - выведет параметры всех серверов
ansible staging_servers  -m setup - выведет параметры группы taging_servers


[staging_servers]
linux1 ansible_host=192.168.15.142 owner=LOL

playbook_debug.yml

---
- name: My super Playbook
  hosts: all
  become: yes

  vars:
     message1: privet
     message2: word
     secret  : LKKDKDKDKDLSDKLSKD

  tasks:

  - name: Print Sectret variable
    debug:
      var: secret

  - debug:
      msg: "Sekretnoe slovo {{ secret }}"

  - debug:
      msg: "Vladelec etogo servera --> {{ owner }} <--"

  - set_fact: full_message=" {{ message1 }} {{ message2 }} from {{ owner }}"

  - debug:
      var: full_message

  - debug:
      var: ansible_distribution

  - debug:
      var: ansible_all_ipv4_addresses

  - shell: uptime
    register: results

  - debug:
      var: results

  - debug:
      var: results.stdout
...