Centos7 deployment AWX based Docker-Compose installation

Centos7 deployment AWX based Docker-Compose installation

AWX Ansible-based Web user interface, REST API and task engine it is Ansible Tower upstream open source projects.

Basic preparation:

In order to reduce problems during installation can be performed as follows violence

1, turn off the firewall

$ Systemctl stop firewalld && systemctl disable firewalld # shut down and not boot from the start firewalld

2, turn off SELinux

1) temporary shutdown: the setenforce 0
2) is permanently closed: Modify / etc / SELinux / config
the SELINUX = Disabled

First, the system configuration requirements

1, at least 4G memory

2, at least 2-core CPU

3, preferably 20G storage

Second, the basic environment requirements:

. 1, Ansible 2.4 +
2, Docker
. 3, Docker Compose
. 4, the python Docker module
5, docker-compose python module
. 6, the Make GUN
. 7, the Git 1.8.4+
. 8, the Node 10.x the LTS
. 9, 6.x of NPM LTS

Third, the installed base relies environment

1, mounted and CentOS ansibleRHEL directly installed through yum

$ sudo yum install ansible

2, installation docker

Centos7 CE installation Docker
1) First, uninstall the old version

$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) install dependencies

$ 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 docker

3, installation Docker Compose

Docker Compose official project is open source project, responsible for fast layout of Docker container cluster.
Directly based on the binary package is installed, you can download 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-compose
sudo chmod +x /usr/local/bin/docker-compose

Direct installation is complete.

4, the python module mounting docker

Use pip to install

$sudo pip install docker

Note: If the system does not pip, can install yum install python-pip pip, and then continue with the installation directly.
If docker-py module before the system is installed, you will need to uninstall

5, mounting docker-compose python module

$sudo pip install docker-compose

6, install git

$sudo yum –y install git

7, install Node and NPM

1) Node download binaries https://nodejs.org/en/download/ node-v10.16.0-linux-x64.tar.xz mounting (tacitly comprising npm 6.9.0)

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

2) unzip and create a soft link (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 the environment variable nodejs

$ cd /etc/profile.d/
$ vim nodejs.sh
  export NODE_HOME=/usr/local/node-v10
  export PATH=$NODE_HOME/bin:$PATH
使配置生效
$ source /etc/profile
检查安装
$ node -v

Fourth, installation and deployment AWX

1, clone a local copy of AMX

$ cd /usr/local/src
$ git clone https://github.com/ansible/awx.git

2, enter the installer directory under awx

$ cd /usr/local/src/awx/installer

Modify inventory file depending on the circumstances
1) For example: You want to deploy on a remote host, you need to modify the inventory files, comments localhost, and then add your remote host address

# localhost ansible_connection=local
awx-server

[all:vars]
...

2) Or you do not want the default database awx, you need to modify the connection information inventory file pg_hostname, pg_username, pg_password, pg_database, pg_port and other databases.
3) If you want ansible of files on the local playbook, the need to modify the inventory file project_data_dir
as: project_data_dir = / var / lib / AWX / Projects
. 4) If you need to set up a local intranet, and so the agent can not, to modify the inventory can file http_proxy, https_proxy.
......

3, began to build and deploy directly

#进去工作目录
cd installer
#开始执行Ansible playbook
ansible-playbook -i inventory -e docker_registry_password=password install.yml

4, the results

After the execution, you can view five runs containers docker ps command on the server. Of course, you have no choice when deploying the default PostgresSQL, may be in four containers, as follows:

CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                                                 NAMES
6c5edbdac687        ansible/awx_task:4.0.0       "/tini -- /bin/sh -c…"   21 hours ago        Up 21 hours         8052/tcp                                              awx_task
6d67a7d33837        ansible/awx_web:4.0.0        "/tini -- /bin/sh -c…"   21 hours ago        Up 21 hours         0.0.0.0:80->8052/tcp                                  awx_web
59d116913853        memcached:alpine             "docker-entrypoint.s…"   26 hours ago        Up 21 hours         11211/tcp                                             awx_memcached
9ea0073fe965        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_rabbitmq
b7ae70f9a653        postgres:9.6                 "docker-entrypoint.s…"   26 hours ago        Up 21 hours         5432/tcp

5, access AWX web service

Once services start properly, you can directly access http: // awx-host (awx-host server address for your deployment services), as
Centos7 deployment AWX based Docker-Compose installation

Default Username: admin
Default Password: password

6, a number of other operations

You can use the docker-compose for AWX management services
such as: Stop AWX: docker-compose stop
updating AWX: docker-compose pull & docker -compose up --force-recreate

Guess you like

Origin blog.51cto.com/10616534/2405212