本文主要是介绍Linux虚拟机上离线安装ansible awx_亲测成功,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Linux虚拟机上离线安装ansible awx_亲测成功
可自行去下载相关包,也可以给我评论留言,我发给大家
ansible awx离线安装----虚拟机上安装 成功-----------------------------
python -V
2.7.5tar -zxvf setuptools-20.0.tar.gz
cd setuptools-20.0
python setup.py installtar -zxvf pycrypto-2.6.1.tar.gz
cd pycrypto-2.6.1/
python setup.py install报错时: error: no acceptable C compiler found in $PATH
有网机器下载
yum install --downloadonly --downloaddir=/data/ansible/gcc gcc
yum install --downloadonly --downloaddir=/data/ansible/g++ gcc-c++cd gcc/
rpm -ivh *.rpmcd g++
rpm -ivh *.rpm报错时 src/MD2.c:31:20: 致命错误:Python.h:没有那个文件或目录
yum install python-devel -y
Tips :若python版本已经为2.6或以上,则不需要再重装python,只是还需要安装python开发包:python-dev(有的操作系统下为python-devel)yum install --downloadonly --downloaddir=/data/ansible/python-devel python-devel
cd python-devel/
rpm -ivh *.rpm然后再执行
cd pycrypto-2.6.1/
python setup.py installtar -zxvf yaml-0.1.5.tar.gz
cd yaml-0.1.5/
./configure --prefix=/usr/local
make --jobs=`grep processor /proc/cpuinfo | wc -l`
make installhttps://pypi.org/simple/pyyaml/
tar -zxvf PyYAML-3.11.tar.gz
cd PyYAML-3.11/
python setup.py installtar -zxvf MarkupSafe-0.9.3.tar.gz
cd MarkupSafe-0.9.3/
python setup.py installtar -zxvf Jinja2-2.7.3.tar.gz
cd Jinja2-2.7.3/
python setup.py installtar -zxvf ecdsa-0.11.tar.gz
cd ecdsa-0.11/
python setup.py installtar -zxvf paramiko-1.15.1.tar.gz
cd paramiko-1.15.1/
python setup.py installtar -zxvf simplejson-3.6.5.tar.gz
cd simplejson-3.6.5/
python setup.py installtar -zxvf pycparser-2.20.tar.gz
cd pycparser-2.20
python setup.py installtar -zxvf ipaddress-1.0.23.tar.gz
cd ipaddress-1.0.23
python setup.py installtar -zxvf enum34-1.1.10.tar.gz
cd enum34-1.1.10
python setup.py installtar -zxvf six-1.15.0.tar.gz
cd six-1.15.0
python setup.py installhttps://pypi.python.org/simple/cryptography/
tar -zxvf cryptography-2.9.2.tar.gz
cd cryptography-2.9.2
python setup.py install报错时: c/_cffi_backend.c:15:17: 致命错误:ffi.h:没有那个文件或目录
yum install --downloadonly --downloaddir=/data/ansible/libffi-devel libffi-devel
cd libffi-devel/
rpm -ivh *.rpmyum install --downloadonly --downloaddir=/data/ansible/openssl-devel openssl-devel
cd openssl-devel
rpm -ivh *.rpmtar -zxvf cffi-1.14.0.tar.gz
cd cffi-1.14.0
python setup.py installhttps://releases.ansible.com/ansible/
wget https://releases.ansible.com/ansible/ansible-2.9.7.tar.gz
tar -zxvf ansible-2.9.7.tar.gz
cd ansible-2.9.7/
python setup.py installansible --versionpip -Vtar -zxvf pip-20.1.1.tar.gz
cd pip-20.1.1
python setup.py install
pip -Vpip download docker -d /data/ansible/docker
pip install --ignore-installed requests --no-index --find-links=file:/data/ansible/docker dockerpip download docker-compose -d /data/ansible/docker_compose
pip install --no-index --find-links=file:/data/ansible/docker_compose docker_composenetstat -tpnl
查看端口占用: 80tar -zxvf awx-13.0.0.tar.gz 需要python3 没成功
cd awx-11.0.0/installer/
vi inventory 可以修改用户名密码
admin_user=admin
admin_password=password
ansible-playbook -i inventory install.ymltar -zxvf 11.0.0.tar.gz 成功安装
cd awx-11.0.0/installer/
ansible-playbook -i inventory install.yml浏览器访问: http://192.168.31.105/
报错: A server error has occurred.vim inventory 修改
postgres_data_dir="/data/ansible/pgdocker"
#host_port_ssl=443
docker_compose_dir="/data/ansible/awxcompose"导入清单
docker exec -it awx_task /bin/bash
cat /data/hosts
[docker-host]
192.168.31.236 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass=root新建一个docker 清单名
awx-manage inventory_import --source=/data/hosts --group-filter=docker-host --inventory-name=docker --keep-vars把容器删除后再试
docker stop awx_task awx_web awx_postgres awx_redis awx_memcached
docker rm awx_task awx_web awx_postgres awx_redis awx_memcached
想法:
安装好的awx,配置好所有软件脚本,然后把容器导出来,到其他机器运行时,各种错误,只有awx_postgres能跑起来.
换种方式: 把镜像和共享卷导出到其他机器上运行,指定好共享卷路径启动 docker-compose.yml 成功了
容器迁移 当前容器保存成镜像
docker commit -p awx_postgres awx_postgres-new 保存成镜像
docker save -o /data/awx_postgres-new.tar awx_postgres-new:latest 导出镜像
docker load -i awx_postgres-new.tar 导入镜像docker save -o /data/awx_memcached.tar memcached:alpine
docker save -o /data/awx_redis.tar redis:latest
docker save -o /data/awx_postgres.tar postgres:10
docker save -o /data/awx_web.tar ansible/awx_web:11.0.0
docker save -o /data/awx_task.tar ansible/awx_task:11.0.0docker run --name awx_redis --privileged=true -d \
-p 6379:6379 \
-v /data/ansible/redis/redis.conf:/usr/local/etc/redis/redis.conf \
-v /data/ansible/redis/redis_socket_standalone:/var/run/redis/ \
awx_redis-newredis.conf 空文件
注释 redis.sock
#unixsocket /var/run/redis/redis.sock
#unixsocketperm 770
redis_socket_standalone 空文件夹
Redis能成功启动了docker run --privileged=true --name awx_memcached -d \
-v /data/ansible/memcached/:/var/run/memcached \
awx_memcached-new
memcached启动失败awx_postgres 启动成功docker run --name awx_web --privileged=true -d \
-p 80:80 \
awx_web-new
Web 失败 要nginx配置
docker run --name awx_task --privileged=true -d \
awx_task-new
task失败 etc/tower/SECRET_KEYtar -zcvf ansible.tar.gz ansible 打包
cd /data/ansible
tar -zcvf awxcompose.tar.gz awxcompose
tar -zcvf pgdocker.tar.gz pgdocker把共享卷awxcompose和pgdocker复制到/data/ansible目录使用docker-compose启动 成功
docker-compose up -d
docker-compose stop
docker-compose rmgetenforce 查询SELinux的运行模式
使用命令setenforce 0 临时设置系统参数
修改/etc/selinux/config文件中设置SELINUX=disabled ,重启服务器cat docker-compose.yml 成功了
version: '2'
services:web:image: ansible/awx_web:11.0.0container_name: awx_webdepends_on:- redis- memcached- postgresports:- "80:8052"hostname: awxwebuser: rootrestart: unless-stoppedvolumes:- supervisor-socket:/var/run/supervisor- rsyslog-socket:/var/run/awx-rsyslog/- rsyslog-config:/var/lib/awx/rsyslog/- "/data/ansible/awxcompose/SECRET_KEY:/etc/tower/SECRET_KEY"- "/data/ansible/awxcompose/environment.sh:/etc/tower/conf.d/environment.sh"- "/data/ansible/awxcompose/credentials.py:/etc/tower/conf.d/credentials.py"- "/data/ansible/awxcompose/nginx.conf:/etc/nginx/nginx.conf:ro"- "/data/ansible/awxcompose/redis_socket:/var/run/redis/:rw"- "/data/ansible/awxcompose/memcached_socket:/var/run/memcached/:rw"environment:http_proxy: ''https_proxy: ''no_proxy: ''task:image: ansible/awx_task:11.0.0container_name: awx_taskdepends_on:- redis- memcached- web- postgreshostname: awxuser: rootrestart: unless-stoppedvolumes:- supervisor-socket:/var/run/supervisor- rsyslog-socket:/var/run/awx-rsyslog/- rsyslog-config:/var/lib/awx/rsyslog/- "/data/ansible/awxcompose/SECRET_KEY:/etc/tower/SECRET_KEY"- "/data/ansible/awxcompose/environment.sh:/etc/tower/conf.d/environment.sh"- "/data/ansible/awxcompose/credentials.py:/etc/tower/conf.d/credentials.py"- "/data/ansible/awxcompose/redis_socket:/var/run/redis/:rw"- "/data/ansible/awxcompose/memcached_socket:/var/run/memcached/:rw"environment:http_proxy: ''https_proxy: ''no_proxy: ''SUPERVISOR_WEB_CONFIG_PATH: '/supervisor.conf'redis:image: redis:latestcontainer_name: awx_redisrestart: unless-stoppedenvironment:http_proxy: ''https_proxy: ''no_proxy: ''command: ["/usr/local/etc/redis/redis.conf"]volumes:- "/data/ansible/awxcompose/redis.conf:/usr/local/etc/redis/redis.conf:ro"- "/data/ansible/awxcompose/redis_socket:/var/run/redis/:rw"- "/data/ansible/awxcompose/memcached_socket:/var/run/memcached/:rw"memcached:image: memcached:alpinecontainer_name: awx_memcachedcommand: ["-s", "/var/run/memcached/memcached.sock", "-a", "0666"]restart: unless-stoppedenvironment:http_proxy: ''https_proxy: ''no_proxy: ''volumes:- "/data/ansible/awxcompose/memcached_socket:/var/run/memcached/:rw"postgres:image: postgres:10container_name: awx_postgresrestart: unless-stoppedvolumes:- /data/ansible/pgdocker/10/data/:/var/lib/postgresql/data/pgdata:Zenvironment:POSTGRES_USER: awxPOSTGRES_PASSWORD: awxpassPOSTGRES_DB: awxPGDATA: /var/lib/postgresql/data/pgdatahttp_proxy: ''https_proxy: ''no_proxy: ''
volumes:supervisor-socket:rsyslog-socket:rsyslog-config:
这篇关于Linux虚拟机上离线安装ansible awx_亲测成功的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!