**ubuntu安装ansible并且安装awx管理**
一、 更新系統(tǒng)
sudo apt update && sudo apt -y upgrade
sudo reboot
二、安裝ansible
sudo apt install ansible
ansible --version
修改ansible主機的主機清單,加入你要執(zhí)行的節(jié)點地址。
vim /etc/ansible/hosts
[web]
192.168.37.140
192.168.37.141
測試結(jié)果 ansible all -m ping 192.168.37.140 | SUCCESS => { "changed": false, "ping": "pong" } 192.168.37.141 | SUCCESS => { "changed": false, "ping": "pong" }
免密ssh-key(可選)
ssh-keygen
ssh-copy-id ip地址
去掉yes/no的詢問
vim /etc/ssh/ssh_confih
StrictHostKeyChecking no
systemctl restart sshd
安裝docker
安裝依賴
sudo apt-get update sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common安裝GPG證書
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
寫入安裝源
sudo add-apt-repository "deb [arch=amd64] docker-ce-linux-ubuntu安裝包下載_開源鏡像站-阿里云 $(lsb_release -cs) stable"
更新并安裝doxker-ce
sudo apt-get -y update sudo apt-get -y install docker-ce
下載安裝docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/1.26.2/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose version
安裝Nodejs和NPM
sudo apt install -y nodejs npm sudo npm install npm --global
安裝docker相關(guān)python庫
sudo apt install python3-pip pwgen sudo pip3 install requests==2.14.2
下載并上傳ansible awx
https://links.jianshu.com/go?to=https%3A%2F%2Fgithub.com%2Fansible%2Fawx%2Farchive%2F3.0.0.tar.gz
解壓進入awx目錄
cd awx/installer/
pwgen -N 1 -s 30(復(fù)制生成的key)
編輯當(dāng)前目錄的inventory文件如下
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python3"
[all:vars] dockerhub_base=ansible awx_task_hostname=awx awx_web_hostname=awxweb postgres_data_dir=/tmp/pgdocker host_port=80 host_port_ssl=443 docker_compose_dir=/tmp/awxcompose pg_username=awx pg_password=awxpass pg_database=awx pg_port=5432 rabbitmq_password=awxpass rabbitmq_erlang_cookie=cookiemonster admin_user=admin admin_password=StrongAdminpassword create_preload_data=True secret_key=(這里為上方key) project_data_dir=/tmp/project
執(zhí)行安裝
apt install python-docker
sudo ansible-playbook -i inventory install.yml
總結(jié)
以上是生活随笔為你收集整理的**ubuntu安装ansible并且安装awx管理**的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: springboot——数据层访问搭建
- 下一篇: 刘润:四个层次决定企业存亡