admin

docker方式快速安装ansible-tower+破解host限制

admin 高可用/自动化 2021-05-21 2823浏览 0

Ansible Tower server

docker是懒人得福音,感谢docker,感谢upshift。

创建docker-compose.yml,直接启动就可以了,如下环境变量密码之类可以自行定义

Running this image with docker-compose

Create docker-compose.yml file as following:

version: '3'

volumes:
  tower_data:
  tower_projects:

services:

  database:
    image: postgres:10-alpine
    volumes:
      - tower_data:/var/lib/postgresql/data
    environment:
        - "POSTGRES_DB=tower"
        - "POSTGRES_USER=tower"
        - "POSTGRES_PASSWORD=tower"

  server:
    image: upshift/ansible-tower:latest
    privileged: true
    depends_on:
        - database
    ports:
        - "8080:80"
        - "8443:443"
    volumes:
        - tower_projects:/var/lib/awx/projects
    environment:
        - "ANSIBLE_TOWER_ADMIN_PASSWORD=password"
        - "ANSIBLE_TOWER_PG_HOST=database"
        - "ANSIBLE_TOWER_PG_PORT=5432"
        - "ANSIBLE_TOWER_PG_DATABASE=tower"
        - "ANSIBLE_TOWER_PG_USERNAME=tower"
        - "ANSIBLE_TOWER_PG_PASSWORD=tower"

运行docker-compose 

 docker-compose up -d

Wait until initialization is complete and go to https://localhost:8443 to access the Tower web ui.

Persistent data (如果需要映射,考虑映射如下文件)

To make your data persistent to upgrading, you should mount named docker volumes or host folders.

Tower server:

  • /var/lib/awx/projects/ ansible projects storage directory

  • /var/lib/awx/job_status/ job outputs directory

  • /var/log/tower/ Ansible Tower logs directory

Database server:

  • /var/lib/postgresql/data/ PostgreSQL database files

Auto configuration via environment variables

This image supports customization via environment variables.

ANSIBLE_TOWER_ADMIN_USERNAME

Default valueadmin

Administrator user name.

ANSIBLE_TOWER_ADMIN_PASSWORD

Default valueredhat

Administrator password.

ANSIBLE_TOWER_ADMIN_EMAIL

Default valueadmin@example.com

Administrator email.

ANSIBLE_TOWER_PG_HOST

Default valuedb

PostgreSQL database server host name.

ANSIBLE_TOWER_PG_PORT

Default value5432

PostgreSQL database server port.

ANSIBLE_TOWER_PG_DATABASE

Default valuetower

PostgreSQL database name.

ANSIBLE_TOWER_PG_USERNAME

Default valuetower

PostgreSQL database username.

ANSIBLE_TOWER_RABBITMQ_USERNAME

Default valuetower

Internal rabbitmq server username.

ANSIBLE_TOWER_RABBITMQ_PASSWORD

Default valuetower

Internal rabbitmq user password.

ANSIBLE_TOWER_RABBITMQ_COOKIE

Default valuetower

Internal rabbitmq erlang cookie.

ANSIBLE_TOWER_CREATE_PRELOAD_DATA

Default valueno

Initialize database with sample data.

ANSIBLE_TOWER_DISABLE_HTTPS

Default valueno

Disable SSL configuration when Tower is behind a reverse proxy.

ANSIBLE_TOWER_REMOVE_TRANSLATIONS

Default valueno

Disable web ui translations, force using english regardless of accept-language sent by the browser.


hosts限制破解:


进入容器:

docker exec -it ad931c54b29e /bin/bash

安装wget

# yum -y install wget

下载get-pip.py

# wget 
https://bootstrap.pypa.io/get-pip.py

安装pip

# python3.6 get-pip.py

安装反编译

# pip install uncompyle6
# ls

__init__.pyc  __pycache__  get-pip.py

反汇编init.pyc

# uncompyle6 __init__.pyc >__init__.py

# vi __init__.py

查找_check_cloudforms_subscription新增return True

 def _check_cloudforms_subscription(self):

 return True

ppppp.jpg


# python -m py_compile __init__.py
# python -O -m py_compile __init__.py

重启ansible-tower,耐心等待

# ansible-tower-service restart

建议将数据从容器中拷贝出来,然后进行文件映射,破解后,license也必须映射。

version: '3'
#volumes:
#  tower_data: /opt/app/awx
#  tower_projects: /opt/app/postgresql
services:
  database:
    image: postgres:10-alpine
    volumes:
      - /opt/app/postgresql/data:/var/lib/postgresql/data
    environment:
        - "POSTGRES_DB=tower"
        - "POSTGRES_USER=tower"
        - "POSTGRES_PASSWORD=hellowin"
  server:
    image: upshift/ansible-tower:latest
    privileged: true
    depends_on:
        - database
    ports:
        - "8080:80"
        - "8443:443"
    volumes:
        - /opt/app/awx/projects:/var/lib/awx/projects
        - /opt/app/tower_license:/var/lib/awx/venv/awx/lib/python3.6/site-packages/tower_license
    environment:
        - "ANSIBLE_TOWER_ADMIN_PASSWORD=hellowin"
        - "ANSIBLE_TOWER_PG_HOST=database"
        - "ANSIBLE_TOWER_PG_PORT=5432"
        - "ANSIBLE_TOWER_PG_DATABASE=tower"
        - "ANSIBLE_TOWER_PG_USERNAME=tower"
        - "ANSIBLE_TOWER_PG_PASSWORD=hellowin"

访问截图

ppppppppppp.jpg

版权声明

本站《作品展示》类文章均为原创,转载必须注明出处,技术分享类文章部分来源于网络,版权归原作者所有,若侵权请留言。