Bo's Oracle Station

查看: 640|回复: 0

ANSIBLE2

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2020-8-5 20:22:52 | 显示全部楼层 |阅读模式
用vim写剧本,要在该用户家目录下创建一个隐含文件.vimrc:
  1. autocmd FileType yaml setlocal ai ts=2 sw=2 et
复制代码

  1. ---
  2. - name: Create User Devops
  3.   hosts: srvgroup
  4.   tasks:
  5.     - name: Create Group:sharedgroup
  6.       group:
  7.         name: sharedgroup
  8.         gid: 6000

  9.     - name: Create User:devops
  10.       user:
  11.         name: devops
  12.         uid: 4000
  13.         group: sharedgroup
复制代码

ansible对于受管节点,有一普查操作:
  1. student@classroom ansible]$ ansible server1.example.com  -m setup
  2. server1.example.com | SUCCESS => {
  3.     "ansible_facts": {
  4.         "ansible_all_ipv4_addresses": [
  5.             "192.168.122.1",
  6.             "192.168.0.101"
  7.         ],
  8.         "ansible_all_ipv6_addresses": [
  9.             "fe80::5054:ff:fefb:e6e2"
  10.         ],
  11.         "ansible_apparmor": {
  12.             "status": "disabled"
  13.         },
  14.         "ansible_architecture": "x86_64",
  15.         "ansible_bios_date": "04/01/2014",
  16.         "ansible_bios_version": "1.11.1-3.module+el8+2529+a9686a4d",
  17.         "ansible_cmdline": {
  18.             "BOOT_IMAGE": "(hd0,msdos1)/vmlinuz-4.18.0-80.el8.x86_64",
  19.             "crashkernel": "auto",
  20.             "quiet": true,
  21.             "rd.lvm.lv": "RAC12crhel7/root",
  22.             "resume": "UUID=c1e4f499-e2be-44d5-b649-10a40f484de5",
  23.             "rhgb": true,
  24.             "ro": true,
  25.             "root": "/dev/mapper/RAC12crhel7-root"
  26.         },
  27.         "ansible_date_time": {
  28.             "date": "2020-08-05",
  29.             "day": "05",
  30.             "epoch": "1596631546",
  31.             "hour": "20",
  32.             "iso8601": "2020-08-05T12:45:46Z",
  33.             "iso8601_basic": "20200805T204546457512",
  34.             "iso8601_basic_short": "20200805T204546",
  35.             "iso8601_micro": "2020-08-05T12:45:46.457692Z",
  36.             "minute": "45",
  37.             "month": "08",
  38.             "second": "46",
  39.             "time": "20:45:46",
  40.             "tz": "CST",
  41.             "tz_offset": "+0800",
  42.             "weekday": "Wednesday",
  43.             "weekday_number": "3",
  44.             "weeknumber": "31",
  45.             "year": "2020"
  46.         },
  47.         "ansible_default_ipv4": {
  48.             "address": "192.168.0.101",
  49.             "alias": "enp1s0",
  50.             "broadcast": "192.168.0.255",
  51.             "gateway": "192.168.0.254",
  52.             "interface": "enp1s0",
  53.             "macaddress": "52:54:00:fb:e6:e2",
  54.             "mtu": 1500,
  55.             "netmask": "255.255.255.0",
  56.             "network": "192.168.0.0",
  57.             "type": "ether"
  58.         },
  59.         "ansible_default_ipv6": {},
  60.         "ansible_device_links": {
  61.             "ids": {
  62.                 "dm-0": [
  63.                     "dm-name-RAC12crhel7-root",
  64.                     "dm-uuid-LVM-nHdecfJXprePDREWmyX4Adefv49jjhoeYcQtGP9blRP0GnUUjeJUxcDYlsZJw3lK"
  65.                 ],
  66.                 "vda2": [
  67.                     "lvm-pv-uuid-Rcem3W-eXgv-1pPY-Awjb-qlxZ-28dd-a0gjBe"
  68.                 ]
  69.             },
  70.             "labels": {},
  71.             "masters": {
  72.                 "vda2": [
  73.                     "dm-0"
  74.                 ]
  75.             },
  76.             "uuids": {
  77.                 "dm-0": [
  78.                     "0ccf2fb6-16c6-4467-9dcf-6d68857b6339"
  79.                 ],
  80.                 "vda1": [
  81.                     "c392dc14-3544-4194-835b-79442df21476"
  82.                 ],
  83.                 "vda3": [
  84.                     "c1e4f499-e2be-44d5-b649-10a40f484de5"
  85.                 ]
  86.             }
  87.         },
  88.         "ansible_devices": {
  89.             "dm-0": {
  90.                 "holders": [],
  91.                 "host": "",
  92.                 "links": {
  93.                     "ids": [
  94.                         "dm-name-RAC12crhel7-root",
  95.                         "dm-uuid-LVM-nHdecfJXprePDREWmyX4Adefv49jjhoeYcQtGP9blRP0GnUUjeJUxcDYlsZJw3lK"
  96.                     ],
  97.                     "labels": [],
  98.                     "masters": [],
  99.                     "uuids": [
  100.                         "0ccf2fb6-16c6-4467-9dcf-6d68857b6339"
  101.                     ]
  102.                 },
  103.                 "model": null,
  104.                 "partitions": {},
  105.                 "removable": "0",
  106.                 "rotational": "1",
  107.                 "sas_address": null,
  108.                 "sas_device_handle": null,
  109.                 "scheduler_mode": "",
  110.                 "sectors": "37683200",
  111.                 "sectorsize": "512",
  112.                 "size": "17.97 GB",
  113.                 "support_discard": "0",
  114.                 "vendor": null,
  115.                 "virtual": 1
  116.             },
  117.             "vda": {
  118.                 "holders": [],
  119.                 "host": "SCSI storage controller: Red Hat, Inc. Virtio block device (rev 01)",
  120.                 "links": {
  121.                     "ids": [],
  122.                     "labels": [],
  123.                     "masters": [],
  124.                     "uuids": []
  125.                 },
  126.                 "model": null,
  127.                 "partitions": {
  128.                     "vda1": {
  129.                         "holders": [],
  130.                         "links": {
  131.                             "ids": [],
  132.                             "labels": [],
  133.                             "masters": [],
  134.                             "uuids": [
  135.                                 "c392dc14-3544-4194-835b-79442df21476"
  136.                             ]
  137.                         },
  138.                         "sectors": "614400",
  139.                         "sectorsize": 512,
  140.                         "size": "300.00 MB",
  141.                         "start": "2048",
  142.                         "uuid": "c392dc14-3544-4194-835b-79442df21476"
  143.                     },
  144.                     "vda2": {
  145.                         "holders": [
  146.                             "RAC12crhel7-root"
  147.                         ],
  148.                         "links": {
  149.                             "ids": [
  150.                                 "lvm-pv-uuid-Rcem3W-eXgv-1pPY-Awjb-qlxZ-28dd-a0gjBe"
  151.                             ],
  152.                             "labels": [],
  153.                             "masters": [
  154.                                 "dm-0"
  155.                             ],
  156.                             "uuids": []
  157.                         },
  158.                         "sectors": "37888000",
  159.                         "sectorsize": 512,
  160.                         "size": "18.07 GB",
  161.                         "start": "616448",
  162.                         "uuid": null
  163.                     },
  164.                     "vda3": {
  165.                         "holders": [],
  166.                         "links": {
  167.                             "ids": [],
  168.                             "labels": [],
  169.                             "masters": [],
  170.                             "uuids": [
  171.                                 "c1e4f499-e2be-44d5-b649-10a40f484de5"
  172.                             ]
  173.                         },
  174.                         "sectors": "2097152",
  175.                         "sectorsize": 512,
  176.                         "size": "1.00 GB",
  177.                         "start": "38504448",
  178.                         "uuid": "c1e4f499-e2be-44d5-b649-10a40f484de5"
  179.                     }
  180.                 },
  181.                 "removable": "0",
  182.                 "rotational": "1",
  183.                 "sas_address": null,
  184.                 "sas_device_handle": null,
  185.                 "scheduler_mode": "mq-deadline",
  186.                 "sectors": "41943040",
  187.                 "sectorsize": "512",
  188.                 "size": "20.00 GB",
  189.                 "support_discard": "0",
  190.                 "vendor": "0x1af4",
  191.                 "virtual": 1
  192.             }
  193.         },
  194.         "ansible_distribution": "RedHat",
  195.         "ansible_distribution_file_parsed": true,
  196.         "ansible_distribution_file_path": "/etc/redhat-release",
  197.         "ansible_distribution_file_search_string": "Red Hat",
  198.         "ansible_distribution_file_variety": "RedHat",
  199.         "ansible_distribution_major_version": "8",
  200.         "ansible_distribution_release": "Ootpa",
  201.         "ansible_distribution_version": "8.0",
  202.         "ansible_dns": {
  203.             "nameservers": [
  204.                 "192.168.0.254"
  205.             ],
  206.             "search": [
  207.                 "example.com"
  208.             ]
  209.         },
  210.         "ansible_domain": "example.com",
  211.         "ansible_effective_group_id": 0,
  212.         "ansible_effective_user_id": 0,
  213.         "ansible_enp1s0": {
  214.             "active": true,
  215.             "device": "enp1s0",
  216.             "features": {
  217.                 "esp_hw_offload": "off [fixed]",
  218.                 "esp_tx_csum_hw_offload": "off [fixed]",
  219.                 "fcoe_mtu": "off [fixed]",
  220.                 "generic_receive_offload": "on",
  221.                 "generic_segmentation_offload": "on",
  222.                 "highdma": "on [fixed]",
  223.                 "hw_tc_offload": "off [fixed]",
  224.                 "l2_fwd_offload": "off [fixed]",
  225.                 "large_receive_offload": "off [fixed]",
  226.                 "loopback": "off [fixed]",
  227.                 "netns_local": "off [fixed]",
  228.                 "ntuple_filters": "off [fixed]",
  229.                 "receive_hashing": "off [fixed]",
  230.                 "rx_all": "off [fixed]",
  231.                 "rx_checksumming": "on [fixed]",
  232.                 "rx_fcs": "off [fixed]",
  233.                 "rx_gro_hw": "off [fixed]",
  234.                 "rx_udp_tunnel_port_offload": "off [fixed]",
  235.                 "rx_vlan_filter": "on [fixed]",
  236.                 "rx_vlan_offload": "off [fixed]",
  237.                 "rx_vlan_stag_filter": "off [fixed]",
  238.                 "rx_vlan_stag_hw_parse": "off [fixed]",
  239.                 "scatter_gather": "on",
  240.                 "tcp_segmentation_offload": "on",
  241.                 "tls_hw_record": "off [fixed]",
  242.                 "tls_hw_tx_offload": "off [fixed]",
  243.                 "tx_checksum_fcoe_crc": "off [fixed]",
  244.                 "tx_checksum_ip_generic": "on",
  245.                 "tx_checksum_ipv4": "off [fixed]",
  246.                 "tx_checksum_ipv6": "off [fixed]",
  247.                 "tx_checksum_sctp": "off [fixed]",
  248.                 "tx_checksumming": "on",
  249.                 "tx_esp_segmentation": "off [fixed]",
  250.                 "tx_fcoe_segmentation": "off [fixed]",
  251.                 "tx_gre_csum_segmentation": "off [fixed]",
  252.                 "tx_gre_segmentation": "off [fixed]",
  253.                 "tx_gso_partial": "off [fixed]",
  254.                 "tx_gso_robust": "on [fixed]",
  255.                 "tx_ipxip4_segmentation": "off [fixed]",
  256.                 "tx_ipxip6_segmentation": "off [fixed]",
  257.                 "tx_lockless": "off [fixed]",
  258.                 "tx_nocache_copy": "off",
  259.                 "tx_scatter_gather": "on",
  260.                 "tx_scatter_gather_fraglist": "off [fixed]",
  261.                 "tx_sctp_segmentation": "off [fixed]",
  262.                 "tx_tcp6_segmentation": "on",
  263.                 "tx_tcp_ecn_segmentation": "on",
  264.                 "tx_tcp_mangleid_segmentation": "off",
  265.                 "tx_tcp_segmentation": "on",
  266.                 "tx_udp_segmentation": "off [fixed]",
  267.                 "tx_udp_tnl_csum_segmentation": "off [fixed]",
  268.                 "tx_udp_tnl_segmentation": "off [fixed]",
  269.                 "tx_vlan_offload": "off [fixed]",
  270.                 "tx_vlan_stag_hw_insert": "off [fixed]",
  271.                 "udp_fragmentation_offload": "off",
  272.                 "vlan_challenged": "off [fixed]"
  273.             },
  274.             "hw_timestamp_filters": [],
  275.             "ipv4": {
  276.                 "address": "192.168.0.101",
  277.                 "broadcast": "192.168.0.255",
  278.                 "netmask": "255.255.255.0",
  279.                 "network": "192.168.0.0"
  280.             },
  281.             "ipv6": [
  282.                 {
  283.                     "address": "fe80::5054:ff:fefb:e6e2",
  284.                     "prefix": "64",
  285.                     "scope": "link"
  286.                 }
  287.             ],
  288.             "macaddress": "52:54:00:fb:e6:e2",
  289.             "module": "virtio_net",
  290.             "mtu": 1500,
  291.             "pciid": "virtio0",
  292.             "promisc": false,
  293.             "speed": -1,
  294.             "timestamping": [
  295.                 "tx_software",
  296.                 "rx_software",
  297.                 "software"
  298.             ],
  299.             "type": "ether"
  300.         },
  301.         "ansible_env": {
  302.             "HOME": "/root",
  303.             "LANG": "C",
  304.             "LC_ALL": "C",
  305.             "LC_CTYPE": "C.UTF-8",
  306.             "LC_MESSAGES": "C",
  307.             "LC_NUMERIC": "C",
  308.             "LOGNAME": "root",
  309.             "LS_COLORS": "rs=0:di=38;5;33:ln=38;5;51:mh=00:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=01;05;37;41:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;40:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.zst=38;5;9:*.tzst=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.wim=38;5;9:*.swm=38;5;9:*.dwm=38;5;9:*.esd=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.mjpg=38;5;13:*.mjpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.m4a=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.oga=38;5;45:*.opus=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:",
  310.             "MAIL": "/var/mail/student",
  311.             "PATH": "/sbin:/bin:/usr/sbin:/usr/bin",
  312.             "PWD": "/home/student",
  313.             "SHELL": "/bin/bash",
  314.             "SHLVL": "1",
  315.             "SUDO_COMMAND": "/bin/sh -c echo BECOME-SUCCESS-wjarhrhrhsgjfriyeimzwqefaqoflwfi ; /usr/libexec/platform-python /home/student/.ansible/tmp/ansible-tmp-1596631542.0631795-29656959781552/AnsiballZ_setup.py",
  316.             "SUDO_GID": "2023",
  317.             "SUDO_UID": "2023",
  318.             "SUDO_USER": "student",
  319.             "TERM": "xterm-256color",
  320.             "USER": "root",
  321.             "USERNAME": "root",
  322.             "_": "/usr/libexec/platform-python"
  323.         },
  324.         "ansible_fibre_channel_wwn": [],
  325.         "ansible_fips": false,
  326.         "ansible_form_factor": "Other",
  327.         "ansible_fqdn": "server1.example.com",
  328.         "ansible_hostname": "server1",
  329.         "ansible_hostnqn": "",
  330.         "ansible_interfaces": [
  331.             "lo",
  332.             "virbr0-nic",
  333.             "virbr0",
  334.             "enp1s0"
  335.         ],
  336.         "ansible_is_chroot": false,
  337.         "ansible_iscsi_iqn": "iqn.1994-05.com.redhat:f5623e69ce84",
  338.         "ansible_kernel": "4.18.0-80.el8.x86_64",
  339.         "ansible_lo": {
  340.             "active": true,
  341.             "device": "lo",
  342.             "features": {
  343.                 "esp_hw_offload": "off [fixed]",
  344.                 "esp_tx_csum_hw_offload": "off [fixed]",
  345.                 "fcoe_mtu": "off [fixed]",
  346.                 "generic_receive_offload": "on",
  347.                 "generic_segmentation_offload": "on",
  348.                 "highdma": "on [fixed]",
  349.                 "hw_tc_offload": "off [fixed]",
  350.                 "l2_fwd_offload": "off [fixed]",
  351.                 "large_receive_offload": "off [fixed]",
  352.                 "loopback": "on [fixed]",
  353.                 "netns_local": "on [fixed]",
  354.                 "ntuple_filters": "off [fixed]",
  355.                 "receive_hashing": "off [fixed]",
  356.                 "rx_all": "off [fixed]",
  357.                 "rx_checksumming": "on [fixed]",
  358.                 "rx_fcs": "off [fixed]",
  359.                 "rx_gro_hw": "off [fixed]",
  360.                 "rx_udp_tunnel_port_offload": "off [fixed]",
  361.                 "rx_vlan_filter": "off [fixed]",
  362.                 "rx_vlan_offload": "off [fixed]",
  363.                 "rx_vlan_stag_filter": "off [fixed]",
  364.                 "rx_vlan_stag_hw_parse": "off [fixed]",
  365.                 "scatter_gather": "on",
  366.                 "tcp_segmentation_offload": "on",
  367.                 "tls_hw_record": "off [fixed]",
  368.                 "tls_hw_tx_offload": "off [fixed]",
  369.                 "tx_checksum_fcoe_crc": "off [fixed]",
  370.                 "tx_checksum_ip_generic": "on [fixed]",
  371.                 "tx_checksum_ipv4": "off [fixed]",
  372.                 "tx_checksum_ipv6": "off [fixed]",
  373.                 "tx_checksum_sctp": "on [fixed]",
  374.                 "tx_checksumming": "on",
  375.                 "tx_esp_segmentation": "off [fixed]",
  376.                 "tx_fcoe_segmentation": "off [fixed]",
  377.                 "tx_gre_csum_segmentation": "off [fixed]",
  378.                 "tx_gre_segmentation": "off [fixed]",
  379.                 "tx_gso_partial": "off [fixed]",
  380.                 "tx_gso_robust": "off [fixed]",
  381.                 "tx_ipxip4_segmentation": "off [fixed]",
  382.                 "tx_ipxip6_segmentation": "off [fixed]",
  383.                 "tx_lockless": "on [fixed]",
  384.                 "tx_nocache_copy": "off [fixed]",
  385.                 "tx_scatter_gather": "on [fixed]",
  386.                 "tx_scatter_gather_fraglist": "on [fixed]",
  387.                 "tx_sctp_segmentation": "on",
  388.                 "tx_tcp6_segmentation": "on",
  389.                 "tx_tcp_ecn_segmentation": "on",
  390.                 "tx_tcp_mangleid_segmentation": "on",
  391.                 "tx_tcp_segmentation": "on",
  392.                 "tx_udp_segmentation": "off [fixed]",
  393.                 "tx_udp_tnl_csum_segmentation": "off [fixed]",
  394.                 "tx_udp_tnl_segmentation": "off [fixed]",
  395.                 "tx_vlan_offload": "off [fixed]",
  396.                 "tx_vlan_stag_hw_insert": "off [fixed]",
  397.                 "udp_fragmentation_offload": "off",
  398.                 "vlan_challenged": "on [fixed]"
  399.             },
  400.             "hw_timestamp_filters": [],
  401.             "ipv4": {
  402.                 "address": "127.0.0.1",
  403.                 "broadcast": "host",
  404.                 "netmask": "255.0.0.0",
  405.                 "network": "127.0.0.0"
  406.             },
  407.             "ipv6": [
  408.                 {
  409.                     "address": "::1",
  410.                     "prefix": "128",
  411.                     "scope": "host"
  412.                 }
  413.             ],
  414.             "mtu": 65536,
  415.             "promisc": false,
  416.             "timestamping": [
  417.                 "tx_software",
  418.                 "rx_software",
  419.                 "software"
  420.             ],
  421.             "type": "loopback"
  422.         },
  423.         "ansible_local": {},
  424.         "ansible_lsb": {},
  425.         "ansible_lvm": {
  426.             "lvs": {
  427.                 "root": {
  428.                     "size_g": "17.97",
  429.                     "vg": "RAC12crhel7"
  430.                 }
  431.             },
  432.             "pvs": {
  433.                 "/dev/vda2": {
  434.                     "free_g": "0.09",
  435.                     "size_g": "18.06",
  436.                     "vg": "RAC12crhel7"
  437.                 }
  438.             },
  439.             "vgs": {
  440.                 "RAC12crhel7": {
  441.                     "free_g": "0.09",
  442.                     "num_lvs": "1",
  443.                     "num_pvs": "1",
  444.                     "size_g": "18.06"
  445.                 }
  446.             }
  447.         },
  448.         "ansible_machine": "x86_64",
  449.         "ansible_machine_id": "b21f44f0957740ec8aa3b1900a9821bd",
  450.         "ansible_memfree_mb": 704,
  451.         "ansible_memory_mb": {
  452.             "nocache": {
  453.                 "free": 1203,
  454.                 "used": 625
  455.             },
  456.             "real": {
  457.                 "free": 704,
  458.                 "total": 1828,
  459.                 "used": 1124
  460.             },
  461.             "swap": {
  462.                 "cached": 0,
  463.                 "free": 1023,
  464.                 "total": 1023,
  465.                 "used": 0
  466.             }
  467.         },
  468.         "ansible_memtotal_mb": 1828,
  469.         "ansible_mounts": [
  470.             {
  471.                 "block_available": 3455276,
  472.                 "block_size": 4096,
  473.                 "block_total": 4707840,
  474.                 "block_used": 1252564,
  475.                 "device": "/dev/mapper/RAC12crhel7-root",
  476.                 "fstype": "xfs",
  477.                 "inode_available": 9295800,
  478.                 "inode_total": 9420800,
  479.                 "inode_used": 125000,
  480.                 "mount": "/",
  481.                 "options": "rw,seclabel,relatime,attr2,inode64,noquota",
  482.                 "size_available": 14152810496,
  483.                 "size_total": 19283312640,
  484.                 "uuid": "0ccf2fb6-16c6-4467-9dcf-6d68857b6339"
  485.             },
  486.             {
  487.                 "block_available": 37918,
  488.                 "block_size": 4096,
  489.                 "block_total": 75432,
  490.                 "block_used": 37514,
  491.                 "device": "/dev/vda1",
  492.                 "fstype": "xfs",
  493.                 "inode_available": 153299,
  494.                 "inode_total": 153600,
  495.                 "inode_used": 301,
  496.                 "mount": "/boot",
  497.                 "options": "rw,seclabel,relatime,attr2,inode64,noquota",
  498.                 "size_available": 155312128,
  499.                 "size_total": 308969472,
  500.                 "uuid": "c392dc14-3544-4194-835b-79442df21476"
  501.             },
  502.             {
  503.                 "block_available": 0,
  504.                 "block_size": 4096,
  505.                 "block_total": 0,
  506.                 "block_used": 0,
  507.                 "device": "/etc/auto.misc",
  508.                 "fstype": "autofs",
  509.                 "inode_available": 0,
  510.                 "inode_total": 0,
  511.                 "inode_used": 0,
  512.                 "mount": "/misc",
  513.                 "options": "rw,relatime,fd=5,pgrp=1793,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=34535",
  514.                 "size_available": 0,
  515.                 "size_total": 0,
  516.                 "uuid": "N/A"
  517.             },
  518.             {
  519.                 "block_available": 0,
  520.                 "block_size": 4096,
  521.                 "block_total": 0,
  522.                 "block_used": 0,
  523.                 "device": "/etc/auto.guests",
  524.                 "fstype": "autofs",
  525.                 "inode_available": 0,
  526.                 "inode_total": 0,
  527.                 "inode_used": 0,
  528.                 "mount": "/home/guests",
  529.                 "options": "rw,relatime,fd=11,pgrp=1793,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=36222",
  530.                 "size_available": 0,
  531.                 "size_total": 0,
  532.                 "uuid": "N/A"
  533.             }
  534.         ],
  535.         "ansible_nodename": "server1.example.com",
  536.         "ansible_os_family": "RedHat",
  537.         "ansible_pkg_mgr": "dnf",
  538.         "ansible_proc_cmdline": {
  539.             "BOOT_IMAGE": "(hd0,msdos1)/vmlinuz-4.18.0-80.el8.x86_64",
  540.             "crashkernel": "auto",
  541.             "quiet": true,
  542.             "rd.lvm.lv": "RAC12crhel7/root",
  543.             "resume": "UUID=c1e4f499-e2be-44d5-b649-10a40f484de5",
  544.             "rhgb": true,
  545.             "ro": true,
  546.             "root": "/dev/mapper/RAC12crhel7-root"
  547.         },
  548.         "ansible_processor": [
  549.             "0",
  550.             "GenuineIntel",
  551.             "Intel Core Processor (Haswell, no TSX)",
  552.             "1",
  553.             "GenuineIntel",
  554.             "Intel Core Processor (Haswell, no TSX)",
  555.             "2",
  556.             "GenuineIntel",
  557.             "Intel Core Processor (Haswell, no TSX)",
  558.             "3",
  559.             "GenuineIntel",
  560.             "Intel Core Processor (Haswell, no TSX)"
  561.         ],
  562.         "ansible_processor_cores": 1,
  563.         "ansible_processor_count": 4,
  564.         "ansible_processor_threads_per_core": 1,
  565.         "ansible_processor_vcpus": 4,
  566.         "ansible_product_name": "KVM",
  567.         "ansible_product_serial": "NA",
  568.         "ansible_product_uuid": "b21f44f0-9577-40ec-8aa3-b1900a9821bd",
  569.         "ansible_product_version": "RHEL-7.6.0 PC (Q35 + ICH9, 2009)",
  570.         "ansible_python": {
  571.             "executable": "/usr/libexec/platform-python",
  572.             "has_sslcontext": true,
  573.             "type": "cpython",
  574.             "version": {
  575.                 "major": 3,
  576.                 "micro": 8,
  577.                 "minor": 6,
  578.                 "releaselevel": "final",
  579.                 "serial": 0
  580.             },
  581.             "version_info": [
  582.                 3,
  583.                 6,
  584.                 8,
  585.                 "final",
  586.                 0
  587.             ]
  588.         },
  589.         "ansible_python_version": "3.6.8",
  590.         "ansible_real_group_id": 0,
  591.         "ansible_real_user_id": 0,
  592.         "ansible_selinux": {
  593.             "config_mode": "enforcing",
  594.             "mode": "enforcing",
  595.             "policyvers": 31,
  596.             "status": "enabled",
  597.             "type": "targeted"
  598.         },
  599.         "ansible_selinux_python_present": true,
  600.         "ansible_service_mgr": "systemd",
  601.         "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEDK6EfPHxNnEXayAL64IuReyV5wYMI7wAtCcz3E0hl3iWSsaYm20GX6e/QRs+hMeVIPlKEfP/zZfgksjGDG4T8=",
  602.         "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIMBMOkk5JFmgpiy6XZ4IWyz7rFkcmc/ZGJpr+hTeQqOc",
  603.         "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCxU3kLhuc5KO1iRie7KwdIjZ8WB+/b7rGeTxiHXZkqr9AajnueZb8cU3W8CG+RAjFtGBDDdGcZwWmdCnTQoxqNtCTlnQ3FwOc+ykzyLSDjAl9ZowonbjrUPEddgtE9azLWv2fWTtwVLRJ5EwVj8tG3OT/G3MzEoQBALTx0o2KMbP2oRtimvCz5ngKz7ERs5ksvdZAt4e9jz5dmcXfExF8Zfm9wuLz3+UDb4pwVr934V4dvBpHzrLCIRNzfk6jdPqS+PVuJTvutAjNX55BAwCIJX+9M8y5QlATvlITE8tC0j+09AWoDZW1jVcrJlBqjwnLjO86sUZzZ22xe5YouANhn",
  604.         "ansible_swapfree_mb": 1023,
  605.         "ansible_swaptotal_mb": 1023,
  606.         "ansible_system": "Linux",
  607.         "ansible_system_capabilities": [
  608.             "cap_chown",
  609.             "cap_dac_override",
  610.             "cap_dac_read_search",
  611.             "cap_fowner",
  612.             "cap_fsetid",
  613.             "cap_kill",
  614.             "cap_setgid",
  615.             "cap_setuid",
  616.             "cap_setpcap",
  617.             "cap_linux_immutable",
  618.             "cap_net_bind_service",
  619.             "cap_net_broadcast",
  620.             "cap_net_admin",
  621.             "cap_net_raw",
  622.             "cap_ipc_lock",
  623.             "cap_ipc_owner",
  624.             "cap_sys_module",
  625.             "cap_sys_rawio",
  626.             "cap_sys_chroot",
  627.             "cap_sys_ptrace",
  628.             "cap_sys_pacct",
  629.             "cap_sys_admin",
  630.             "cap_sys_boot",
  631.             "cap_sys_nice",
  632.             "cap_sys_resource",
  633.             "cap_sys_time",
  634.             "cap_sys_tty_config",
  635.             "cap_mknod",
  636.             "cap_lease",
  637.             "cap_audit_write",
  638.             "cap_audit_control",
  639.             "cap_setfcap",
  640.             "cap_mac_override",
  641.             "cap_mac_admin",
  642.             "cap_syslog",
  643.             "cap_wake_alarm",
  644.             "cap_block_suspend",
  645.             "cap_audit_read+ep"
  646.         ],
  647.         "ansible_system_capabilities_enforced": "True",
  648.         "ansible_system_vendor": "Red Hat",
  649.         "ansible_uptime_seconds": 3398,
  650.         "ansible_user_dir": "/root",
  651.         "ansible_user_gecos": "root",
  652.         "ansible_user_gid": 0,
  653.         "ansible_user_id": "root",
  654.         "ansible_user_shell": "/bin/bash",
  655.         "ansible_user_uid": 0,
  656.         "ansible_userspace_architecture": "x86_64",
  657.         "ansible_userspace_bits": "64",
  658.         "ansible_virbr0": {
  659.             "active": false,
  660.             "device": "virbr0",
  661.             "features": {
  662.                 "esp_hw_offload": "off [fixed]",
  663.                 "esp_tx_csum_hw_offload": "off [fixed]",
  664.                 "fcoe_mtu": "off [fixed]",
  665.                 "generic_receive_offload": "on",
  666.                 "generic_segmentation_offload": "on",
  667.                 "highdma": "off [requested on]",
  668.                 "hw_tc_offload": "off [fixed]",
  669.                 "l2_fwd_offload": "off [fixed]",
  670.                 "large_receive_offload": "off [fixed]",
  671.                 "loopback": "off [fixed]",
  672.                 "netns_local": "on [fixed]",
  673.                 "ntuple_filters": "off [fixed]",
  674.                 "receive_hashing": "off [fixed]",
  675.                 "rx_all": "off [fixed]",
  676.                 "rx_checksumming": "off [fixed]",
  677.                 "rx_fcs": "off [fixed]",
  678.                 "rx_gro_hw": "off [fixed]",
  679.                 "rx_udp_tunnel_port_offload": "off [fixed]",
  680.                 "rx_vlan_filter": "off [fixed]",
  681.                 "rx_vlan_offload": "off [fixed]",
  682.                 "rx_vlan_stag_filter": "off [fixed]",
  683.                 "rx_vlan_stag_hw_parse": "off [fixed]",
  684.                 "scatter_gather": "on",
  685.                 "tcp_segmentation_offload": "on",
  686.                 "tls_hw_record": "off [fixed]",
  687.                 "tls_hw_tx_offload": "off [fixed]",
  688.                 "tx_checksum_fcoe_crc": "off [fixed]",
  689.                 "tx_checksum_ip_generic": "on",
  690.                 "tx_checksum_ipv4": "off [fixed]",
  691.                 "tx_checksum_ipv6": "off [fixed]",
  692.                 "tx_checksum_sctp": "off [fixed]",
  693.                 "tx_checksumming": "on",
  694.                 "tx_esp_segmentation": "on",
  695.                 "tx_fcoe_segmentation": "off [requested on]",
  696.                 "tx_gre_csum_segmentation": "on",
  697.                 "tx_gre_segmentation": "on",
  698.                 "tx_gso_partial": "on",
  699.                 "tx_gso_robust": "off [requested on]",
  700.                 "tx_ipxip4_segmentation": "on",
  701.                 "tx_ipxip6_segmentation": "on",
  702.                 "tx_lockless": "on [fixed]",
  703.                 "tx_nocache_copy": "off",
  704.                 "tx_scatter_gather": "on",
  705.                 "tx_scatter_gather_fraglist": "on",
  706.                 "tx_sctp_segmentation": "off [requested on]",
  707.                 "tx_tcp6_segmentation": "on",
  708.                 "tx_tcp_ecn_segmentation": "on",
  709.                 "tx_tcp_mangleid_segmentation": "on",
  710.                 "tx_tcp_segmentation": "on",
  711.                 "tx_udp_segmentation": "on",
  712.                 "tx_udp_tnl_csum_segmentation": "on",
  713.                 "tx_udp_tnl_segmentation": "on",
  714.                 "tx_vlan_offload": "on",
  715.                 "tx_vlan_stag_hw_insert": "on",
  716.                 "udp_fragmentation_offload": "off",
  717.                 "vlan_challenged": "off [fixed]"
  718.             },
  719.             "hw_timestamp_filters": [],
  720.             "id": "8000.525400876dea",
  721.             "interfaces": [
  722.                 "virbr0-nic"
  723.             ],
  724.             "ipv4": {
  725.                 "address": "192.168.122.1",
  726.                 "broadcast": "192.168.122.255",
  727.                 "netmask": "255.255.255.0",
  728.                 "network": "192.168.122.0"
  729.             },
  730.             "macaddress": "52:54:00:87:6d:ea",
  731.             "mtu": 1500,
  732.             "promisc": false,
  733.             "stp": true,
  734.             "timestamping": [
  735.                 "rx_software",
  736.                 "software"
  737.             ],
  738.             "type": "bridge"
  739.         },
  740.         "ansible_virbr0_nic": {
  741.             "active": false,
  742.             "device": "virbr0-nic",
  743.             "features": {
  744.                 "esp_hw_offload": "off [fixed]",
  745.                 "esp_tx_csum_hw_offload": "off [fixed]",
  746.                 "fcoe_mtu": "off [fixed]",
  747.                 "generic_receive_offload": "on",
  748.                 "generic_segmentation_offload": "on",
  749.                 "highdma": "off [fixed]",
  750.                 "hw_tc_offload": "off [fixed]",
  751.                 "l2_fwd_offload": "off [fixed]",
  752.                 "large_receive_offload": "off [fixed]",
  753.                 "loopback": "off [fixed]",
  754.                 "netns_local": "off [fixed]",
  755.                 "ntuple_filters": "off [fixed]",
  756.                 "receive_hashing": "off [fixed]",
  757.                 "rx_all": "off [fixed]",
  758.                 "rx_checksumming": "off [fixed]",
  759.                 "rx_fcs": "off [fixed]",
  760.                 "rx_gro_hw": "off [fixed]",
  761.                 "rx_udp_tunnel_port_offload": "off [fixed]",
  762.                 "rx_vlan_filter": "off [fixed]",
  763.                 "rx_vlan_offload": "off [fixed]",
  764.                 "rx_vlan_stag_filter": "off [fixed]",
  765.                 "rx_vlan_stag_hw_parse": "off [fixed]",
  766.                 "scatter_gather": "on",
  767.                 "tcp_segmentation_offload": "off",
  768.                 "tls_hw_record": "off [fixed]",
  769.                 "tls_hw_tx_offload": "off [fixed]",
  770.                 "tx_checksum_fcoe_crc": "off [fixed]",
  771.                 "tx_checksum_ip_generic": "off [requested on]",
  772.                 "tx_checksum_ipv4": "off [fixed]",
  773.                 "tx_checksum_ipv6": "off [fixed]",
  774.                 "tx_checksum_sctp": "off [fixed]",
  775.                 "tx_checksumming": "off",
  776.                 "tx_esp_segmentation": "off [fixed]",
  777.                 "tx_fcoe_segmentation": "off [fixed]",
  778.                 "tx_gre_csum_segmentation": "off [fixed]",
  779.                 "tx_gre_segmentation": "off [fixed]",
  780.                 "tx_gso_partial": "off [fixed]",
  781.                 "tx_gso_robust": "off [fixed]",
  782.                 "tx_ipxip4_segmentation": "off [fixed]",
  783.                 "tx_ipxip6_segmentation": "off [fixed]",
  784.                 "tx_lockless": "on [fixed]",
  785.                 "tx_nocache_copy": "off",
  786.                 "tx_scatter_gather": "on",
  787.                 "tx_scatter_gather_fraglist": "on",
  788.                 "tx_sctp_segmentation": "off [fixed]",
  789.                 "tx_tcp6_segmentation": "off [requested on]",
  790.                 "tx_tcp_ecn_segmentation": "off [requested on]",
  791.                 "tx_tcp_mangleid_segmentation": "off",
  792.                 "tx_tcp_segmentation": "off [requested on]",
  793.                 "tx_udp_segmentation": "off [fixed]",
  794.                 "tx_udp_tnl_csum_segmentation": "off [fixed]",
  795.                 "tx_udp_tnl_segmentation": "off [fixed]",
  796.                 "tx_vlan_offload": "on",
  797.                 "tx_vlan_stag_hw_insert": "on",
  798.                 "udp_fragmentation_offload": "off",
  799.                 "vlan_challenged": "off [fixed]"
  800.             },
  801.             "hw_timestamp_filters": [],
  802.             "macaddress": "52:54:00:87:6d:ea",
  803.             "mtu": 1500,
  804.             "promisc": true,
  805.             "timestamping": [
  806.                 "tx_software",
  807.                 "rx_software",
  808.                 "software"
  809.             ],
  810.             "type": "ether"
  811.         },
  812.         "ansible_virtualization_role": "guest",
  813.         "ansible_virtualization_type": "kvm",
  814.         "discovered_interpreter_python": "/usr/libexec/platform-python",
  815.         "gather_subset": [
  816.             "all"
  817.         ],
  818.         "module_setup": true
  819.     },
  820.     "changed": false
  821. }
  822. [student@classroom ansible]$
复制代码
普查操作结果的过滤:

  1. [student@classroom ansible]$ ansible classroom.example.com  -m setup -a 'filter="ansible_mounts"'
复制代码
2020-08-15 14-37-10 的屏幕截图.png


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-20 12:08 , Processed in 0.030599 second(s), 27 queries .

快速回复 返回顶部 返回列表