vps какого из хостингов вы используете
Я думал что сам провайдер доменных имён может напрямую заблочить DNS
nginx_version: "{{ dpkg_data.stdout_lines | select('search', 'Version') | first | default('Version not found') | regex_replace('Version: ', '') }}"
- hosts: APP gather_facts: yes
tasks:
- name: Gather package facts
package_facts:
manager: auto
- name: Get installed package version (example package)
command: "dpkg -s nginx"
register: dpkg_data
changed_when: false
ignore_errors: true
- name: Set fact for nginx version
set_fact:
nginx_version: "{{ dpkg_data.stdout_lines | select('search', 'Version') | first | default('Version not found') }}"
- name: Collect information
set_fact:
host_info: "{{ ansible_hostname }},{{ ansible_default_ipv4.address }},{{ nginx_version | regex_replace('\n', '; ') }}"
- name: Collect information from all hosts
lineinfile:
path: "collected_info.csv"
line: "{{ hostvars[item].host_info }}"
create: yes
with_items: "{{ ansible_play_batch }}"
delegate_to: localhost
run_once: true
- hosts: APP gather_facts: yes
tasks:
- name: Gather package facts
package_facts:
manager: auto
- name: Get installed package version (example package)
command: "dpkg-query --showformat='${Version}' --show nginx"
register: nginx_version
changed_when: false
ignore_errors: true
- name: Collect information
set_fact:
host_info: "{{ ansible_hostname }},{{ ansible_default_ipv4.address }},{{ nginx_version.stdout | regex_replace('\n', '; ') }}"
- name: Collect information from all hosts
lineinfile:
path: "collected_info.csv"
line: "{{ hostvars[item].host_info }}"
create: yes
with_items: "{{ ansible_play_batch }}"
delegate_to: localhost
run_once: true
- hosts: APP
gather_facts: yes
tasks:
- name: Gather package facts
package_facts:
manager: auto
- name: Get version of nginx using shell and grep
shell: "dpkg -s nginx | grep Version | tr -d '\\n'"
register: nginx_version
changed_when: false
- name: Collect information
set_fact:
host_info: "{{ ansible_hostname }},{{ ansible_default_ipv4.address }},{{ nginx_version.stdout | regex_replace('\n', '; ') }}"
- name: Collect information from all hosts
lineinfile:
path: "collected_info.csv"
line: "{{ hostvars[item].host_info }}"
create: yes
with_items: "{{ ansible_play_batch }}"
delegate_to: localhost
run_once: true
- hosts: APP
gather_facts: yes
tasks:
- name: Gather package facts
package_facts:
manager: auto
- name: Set fact for nginx version
set_fact:
nginx_version: "{{ ansible_facts.packages['nginx'][0].version | default('Not installed') }}"
- name: Collect information
set_fact:
host_info: "{{ ansible_hostname }},{{ ansible_default_ipv4.address }},{{ nginx_version | regex_replace('\n', '; ') }}"
- name: Collect information from all hosts
lineinfile:
path: "collected_info.csv"
line: "{{ hostvars[item].host_info }}"
create: yes
with_items: "{{ ansible_play_batch }}"
delegate_to: localhost
run_once: true
- hosts: APP
gather_facts: yes
tasks:
- name: Get installed package version (example package)
command: dpkg -l
register: package_version
changed_when: false
- name: Collect information
set_fact:
host_info: "{{ ansible_hostname }},{{ ansible_default_ipv4.address }},{{ package_version.stdout_lines | join('; ') }}"
- name: Collect information from all hosts
lineinfile:
path: "collected_info.csv"
line: "{{ hostvars[item].host_info }}"
create: yes
with_items: "{{ ansible_play_batch }}"
delegate_to: localhost
run_once: true
[APP]
server1
server2
---
- name: Gather system information from multiple hosts and save to one local file
hosts: APP
gather_facts: yes
tasks:
- name: Get installed package version (example package)
command: dpkg -l
register: package_version
changed_when: false
- name: Collect information
set_fact:
host_info: |
Hostname: {{ ansible_hostname }}
IP Address: {{ ansible_default_ipv4.address }}
Installed Package Version: {{ package_version.stdout }}
delegate_to: localhost
run_once: false
- name: Save all host informations to one file
delegate_to: localhost
lineinfile:
path: "/tmp/collected_info.txt"
line: "{{ host_info }}"
create: yes
run_once: false
Такой вопрос, на данный момент на компьютерах как прокси сервер прописан Forefront TMG, получится ли сделать так же?