In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "ansible installation method and basic use", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "ansible installation method and basic use"!
Server installation ansible
[root@k8s-mater]yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm[root@k8s-mater]yum install ansible -y[root@k8s-master ansible]# ansible --helpUsage: ansible [options]Options: -a MODULE_ARGS, --args=MODULE_ARGS module arguments -k, --ask-pass ask for SSH password --ask-su-pass ask for su password -K, --ask-sudo-pass ask for sudo password --ask-vault-pass ask for vault password -B SECONDS, --background=SECONDS run asynchronously, failing after X seconds (default=N/A) -C, --check don't make any changes; instead, try to predict some of the changes that may occur -c CONNECTION, --connection=CONNECTION connection type to use (default=smart) -f FORKS, --forks=FORKS specify number of parallel processes to use (default=5) -h, --help show this help message and exit -i INVENTORY, --inventory-file=INVENTORY specify inventory host file (default=/etc/ansible/hosts) -l SUBSET, --limit=SUBSET further limit selected hosts to an additional pattern --list-hosts outputs a list of matching hosts; does not execute anything else -m MODULE_NAME, --module-name=MODULE_NAME module name to execute (default=command) -M MODULE_PATH, --module-path=MODULE_PATH specify path(s) to module library (default=/usr/share/ansible/) -o, --one-line condense output -P POLL_INTERVAL, --poll=POLL_INTERVAL set the poll interval if using -B (default=15) --private-key=PRIVATE_KEY_FILE use this file to authenticate the connection -S, --su run operations with su -R SU_USER, --su-user=SU_USER run operations with su as this user (default=root) -s, --sudo run operations with sudo (nopasswd) -U SUDO_USER, --sudo-user=SUDO_USER desired sudo user (default=root) -T TIMEOUT, --timeout=TIMEOUT override the SSH timeout in seconds (default=10) -t TREE, --tree=TREE log output to this directory -u REMOTE_USER, --user=REMOTE_USER connect as this user (default=root) --vault-password-file=VAULT_PASSWORD_FILE vault password file -v, --verbose verbose mode (-vvv for more, -vvvv to enable connection debugging) --version show program's version number and exit
Configure hosts for subsequent manipulation of remote hosts
cd /etc/ansiblevim hosts## db-[99:101]-node.example.com192.168.189.89
Edit/etc/ansible/ansible.cfg
inventory = /etc/ansible/hosts #Remove comments #
test command
[root@k8s-master ansible]# ansible localhost -m pinglocalhost | SUCCESS => { "changed": false, "ping": "pong"}[root@k8s-master ansible]# ansible localhost -m command -a "df -h"localhost | CHANGED |rc=0 >> File system Capacity Used Available Used % mount point/dev/mapper/centos-root 17G 5.5G 12G 33% /devtmpfs 475M 0 475M 0% /devtmpfs 487M 124K 487M 1% /dev/shmtmpfs 487M 14M 473M 3% /runtmpfs 487M 0 487M 0% /sys/fs/cgroup/dev/sda1 1014M 133M 882M 14% /boottmpfs 98M 0 98M 0% /run/user/0 At this point, I believe that everyone has a deeper understanding of "ansible installation method and basic use". Let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.