Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos7 installs and deploys AWX based on Docker-Compose

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Centos7 installs and deploys AWX based on Docker-Compose

AWX provides an Ansible-based Web user interface, REST API, and task engine, which is an upstream open source project for Ansible Tower.

Basic preparation:

To reduce problems during installation, you can do the following violent operations

1. Turn off the firewall

$systemctl stop firewalld & & systemctl disable firewalld # shuts down and boots without self-starting firewalld

2. Close SELinux

1) temporarily shut down: setenforce 0

2) permanent shutdown: modify / etc/selinux/config

SELINUX=disabled

1. System configuration requirements 1, minimum 4 GB memory 2, minimum 2 core CPU3, best 20 GB storage space 2, basic environment requirements:

1. Ansible 2.4 +

2 、 Docker

3 、 Docker Compose

4. Python module of docker

5. Python module of docker-compose

6 、 GUN Make

7. Git 1.8.4 +

8 、 Node 10.x LTS

9 、 NPM 6.x LTS

3. Installation basic environment depends on 1. Install ansibleRHEL and CentOS directly through yum to install $sudo yum install ansible2 and install docker.

Centos7 install Docker CE

1) Uninstall the old version first

$sudo yum remove docker\ docker-client\ docker-client-latest\ docker-common\ docker-latest\ docker-latest-logrotate\ docker-logrotate\ docker-selinux\ docker-engine-selinux\ docker-engine

2) installation dependency

$sudo yum install-y yum-utils\ device-mapper-persistent-data\ lvm2

3) installation

$sudo yum install docker-ce

4) start Docker CE

$sudo systemctl start docker3, install Docker Compose

The Compose project is the official open source project of Docker, which is responsible for the rapid orchestration of Docker container clusters.

Directly based on the binary package installation, download the compiled binaries directly from the official.

Sudo curl-L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname-s`-`uname-m` > / usr/local/bin/docker-composesudo chmod + x / usr/local/bin/docker-compose

The installation is completed directly.

4. Install the python module of docker

Use pip for installation

$sudo pip install docker

Note: if the system does not have pip, you can install pip directly through yum install python-pip, and then continue with the installation.

If the system has previously installed the docker-py module, you need to uninstall it first

5. Install docker-compose 's python module $sudo pip install docker-compose6, install git$sudo yum-y install git7, install Node and NPM

1) download the Node binary installation package https://nodejs.org/en/download/ node-v10.16.0-linux-x64.tar.xz (npm 6.9.0 is already included by default)

$cd / usr/local/src/ $sudo wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz

2) decompress and establish a soft connection (easy to find)

$sudo tar-xvf node-v10.16.0-linux-x64.tar.xz-C / usr/local$sudo ln-s node-v10.16.0-linux-x64 node-v10

3) set nodejs environment variable

$cd / etc/profile.d/$ vim nodejs.sh export NODE_HOME=/usr/local/node-v10 export PATH=$NODE_HOME/bin:$PATH make configuration effective $source / etc/profile check install $node-v IV, install and deploy AWX1, clone a local copy of AMX $cd / usr/local/src$ git clone https://github.com/ansible/awx.git2, enter installer$ cd / usr/local/src/awx/installer under the awx directory

Modify inventory file according to specific situation

1) for example, if you want to deploy on a remote host, you need to modify the inventory file, comment localhost, and then add your remote host address

# localhost ansible_connection=localawx-server [all:vars]...

2) or if you don't want the default database of awx, you need to modify the connection information of pg_hostname, pg_username, pg_password, pg_database, pg_port and other databases in the inventory file.

3) if you want to keep the playbook file of ansible locally, you need to modify the project_data_dir in the inventory file

Such as: project_data_dir=/var/lib/awx/projects

4) if you need to set up a proxy if you can't connect to the Internet locally, you can modify the http_proxy and https_proxy in the inventory file.

.

3. Start building and deploying directly # enter the working directory cd installer# to execute Ansible playbookansible-playbook-I inventory-e docker_registry_password=password install.yml4 and execute the results

After execution, you can use the docker ps command on the server to see five running containers. Of course, you don't choose the default PostgresSQL when you deploy, there may be only four containers, as shown below:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES6c5edbdac687 ansible/awx_task:4.0.0 "/ tini-/ bin/sh-c..." 21 hours ago Up 21 hours 8052/tcp awx_task6d67a7d33837 ansible/awx_web:4.0.0 "/ tini-/ bin/sh-c …" 21 hours ago Up 21 hours 0.0.0.0 8052/tcp awx_web59d116913853 memcached:alpine 80-> 8052/tcp awx_web59d116913853 memcached:alpine "docker-entrypoint.s …" 26 hours ago Up 21 hours 11211/tcp awx_memcached9ea0073fe965 ansible/awx_rabbitmq:3.7.4 "docker-entrypoint.s …" 26 hours ago Up 21 hours 4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp awx_rabbitmqb7ae70f9a653 postgres:9.6 "docker-entrypoint.s..." 26 hours ago Up 21 hours 5432/tcp5, access AWX web service

After the service starts normally, you can directly access http://awx-host (awx-host is the server address where you deploy the service), as shown in the figure

Default user name: admin

Default password: password

6. Some other operations

You can use docker-compose to manage AWX services

For example, stop AWX:docker-compose stop

Update AWX:docker-compose pull & docker-compose up-- force-recreate

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report