首页 > 其他分享 >Ansible AWX运行容器分析与解读

Ansible AWX运行容器分析与解读

时间:2023-05-25 14:11:22浏览次数:49  
标签:容器 stderr stdout AWX maxbytes Ansible awx logfile true

1、awx-demo-web容器

容器运行指令:

/usr/bin/launch_awx.sh -> exec supervisord -c /etc/supervisord.conf

该启动脚本使用supervisord托管awx进程,以下是/etc/supervisord.conf文件内容:

[supervisord]
nodaemon = True
umask = 022
logfile = /dev/stdout
logfile_maxbytes = 0
pidfile = /var/run/supervisor/supervisor.web.pid

[program:nginx]
command = nginx -g "daemon off;"
autorestart = true
startsecs = 30
stopasgroup=true
killasgroup=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:uwsgi]

command = /var/lib/awx/venv/awx/bin/uwsgi /etc/tower/uwsgi.ini
directory = /var/lib/awx
autorestart = true
startsecs = 30
stopasgroup=true
killasgroup=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:daphne]
command = /var/lib/awx/venv/awx/bin/daphne -b 127.0.0.1 -p 8051 --websocket_timeout -1 awx.asgi:channel_layer
directory = /var/lib/awx
autorestart = true
startsecs = 30
stopasgroup=true
killasgroup=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:wsbroadcast]
command = awx-manage run_wsbroadcast
directory = /var/lib/awx
autorestart = true
startsecs = 30
stopasgroup=true
killasgroup=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:awx-rsyslogd]
command = rsyslogd -n -i /var/run/awx-rsyslog/rsyslog.pid -f /var/lib/awx/rsyslog/rsyslog.conf
autorestart = true
startsecs = 30
stopasgroup=true
killasgroup=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[group:tower-processes]
programs=nginx,uwsgi,daphne,wsbroadcast,awx-rsyslogd
priority=5

[eventlistener:superwatcher]
command=stop-supervisor
events=PROCESS_STATE_FATAL
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[unix_http_server]
file=/var/run/supervisor/supervisor.web.sock

[supervisorctl]
serverurl=unix:///var/run/supervisor/supervisor.web.sock ; use a unix:// URL  for a unix socket

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

这是一个Supervisor配置文件,用于管理AWX的进程。Supervisor是一个进程控制系统,可以在Linux系统上监控和管理后台进程。在这个配置文件中,有五个进程组成了一个名为“tower-processes”的组。其中包括:

  • nginx:Web服务器,用于提供AWX的Web界面。
  • uwsgi:Web服务器网关接口,它充当Web服务器和Django应用程序之间的中间件。
  • daphne:异步Web服务器,它支持WebSocket和长轮询协议。
  • wsbroadcast:AWX中的一个后台进程,用于处理实时更新和通知。
  • awx-rsyslogd:AWX中的一个后台进程,用于处理系统日志。

在这个配置文件中,每个进程都有一个名为“program”的段,其中定义了进程的命令、工作目录、重启策略和日志文件路径等信息。此外,还定义了一个名为“superwatcher”的事件监听器,用于在进程崩溃时停止Supervisor本身。

2、awx-demo-task容器

容器运行指令:

/usr/bin/launch_awx_task.sh -> exec supervisord -c /etc/supervisord_task.conf

该启动脚本使用supervisord托管awx进程,以下是/etc/supervisord_task.conf文件内容:

[supervisord]
nodaemon = True
umask = 022
logfile = /dev/stdout
logfile_maxbytes = 0
pidfile = /var/run/supervisor/supervisor.pid

[program:dispatcher]
command = awx-manage run_dispatcher
directory = /var/lib/awx
autorestart = true
startsecs = 30
stopasgroup=true
killasgroup=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:callback-receiver]
command = awx-manage run_callback_receiver
directory = /var/lib/awx
autorestart = true
startsecs = 30
stopasgroup=true
killasgroup=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[group:tower-processes]
programs=dispatcher,callback-receiver
priority=5

[eventlistener:superwatcher]
command=stop-supervisor
events=PROCESS_STATE_FATAL
autorestart = true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[unix_http_server]
file=/var/run/supervisor/supervisor.sock

[supervisorctl]
serverurl=unix:///var/run/supervisor/supervisor.sock ; use a unix:// URL  for a unix socket

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

这是一个Supervisor配置文件,它用于管理AWX的进程。Supervisor是一个进程管理工具,可以自动启动、停止和重启进程。该配置文件中定义了两个程序,即dispatchercallback-receiver,它们都是AWX的核心组件。同时,还定义了一个进程组tower-processes,该组中包含了这两个程序。此外,还定义了一个事件监听器superwatcher,它会在出现致命错误时停止Supervisor进程。最后,还定义了Supervisor的一些基本配置,例如日志文件的位置和大小限制,以及RPC接口的设置。

awx-manage run_dispatcher是用于启动AWX任务分发器的命令。它会在AWX系统中启动一个任务分发器进程,该进程会监听任务队列并将任务分发给相应的执行节点。执行该命令需要在AWX系统的命令行中运行。

awx-manage run_callback_receiver是用于启动AWX回调接收器的命令。回调接收器进程负责接收来自Ansible任务的回调信息,并将其发送到AWX系统中进行处理和记录。

3、awx-demo-ee容器

容器运行指令:

receptor --config /etc/receptor/receptor.conf

该命令用于启动Receptor代理,使用的配置文件为/etc/receptor/receptor.conf。Receptor是一个轻量级的代理框架,旨在为异构网络提供通信和协作能力。通过Receptor,可以将不同的网络连接在一起,使它们之间能够互相通信和交换数据。在启动Receptor代理之前,需要先配置好代理的参数和配置文件。

其配置文件内容如下:

- local-only: null
- log-level: debug
- node:
    firewallrules:
    - action: reject
      tonode: awx-demo-576484dbfd-hkqjq
      toservice: control
- control-service:
    filename: /var/run/receptor/receptor.sock
    permissions: '0660'
    service: control
- work-command:
    allowruntimeparams: true
    command: ansible-runner
    params: worker
    worktype: local
- work-signing:
    privatekey: /etc/receptor/signing/work-private-key.pem
    tokenexpiration: 1m
- work-kubernetes:
    allowruntimeauth: true
    allowruntimeparams: true
    allowruntimepod: true
    authmethod: runtime
    worktype: kubernetes-runtime-auth
- work-kubernetes:
    allowruntimeauth: true
    allowruntimeparams: true
    allowruntimepod: true
    authmethod: incluster
    worktype: kubernetes-incluster-auth
- tls-client:
    cert: /etc/receptor/tls/receptor.crt
    key: /etc/receptor/tls/receptor.key
    name: tlsclient
    rootcas: /etc/receptor/tls/ca/receptor-ca.crt

这是一个YAML格式的配置文件,用于配置Receptor代理的参数和选项。下面是各个参数的解释:

  • local-only: null:这个参数表示是否只允许本地连接,即只有在本地的Receptor节点才能使用代理服务。null表示未设置该选项,即允许远程连接。
  • log-level: debug:这个参数表示日志输出的级别,debug表示输出所有调试信息。
  • node: 这个参数表示Receptor节点的配置信息,包括防火墙规则等。这里定义了一个防火墙规则,即拒绝从当前节点到目标节点(名为awx-demo-576484dbfd-hkqjq)的control服务连接。
  • control-service: 这个参数表示控制服务的配置信息,包括服务的名称、文件路径和权限等。
  • work-command: 这个参数表示工作命令的配置信息,包括命令的名称、类型和运行参数等。这里定义了一个类型为local的工作命令,即在本地运行ansible-runner命令,并允许运行时传递参数。
  • work-signing: 这个参数表示工作签名的配置信息,包括私钥和令牌过期时间等。这里定义了一个过期时间为1分钟的签名,用于对工作进行认证和授权。
  • work-kubernetes: 这个参数表示在Kubernetes环境中运行工作的配置信息,包括认证方式、类型和运行参数等。这里定义了两个不同的工作类型,分别使用runtime和incluster方式进行认证。
  • tls-client: 这个参数表示TLS客户端的配置信息,包括证书、密钥和根证书等。这里定义了一个名为tlsclient的TLS客户端,用于与其他节点建立安全连接。

标签:容器,stderr,stdout,AWX,maxbytes,Ansible,awx,logfile,true
From: https://www.cnblogs.com/wang-hongwei/p/17431032.html

相关文章

  • 5人5月用容器技术保卫蓝天
    摘要:让我们走进四川国蓝中天与华为云的合作案例,一起看看容器技术是如何保卫蓝天的。本文分享自华为云社区《锚定云原生发展!华为云DTSE助力国蓝中天破解容器难题》,作者:华为云赋能云团队四川鲲鹏&欧拉生态创新中心。“一旦发现区域内的污染源,就会精准锁定、自动派单、闭环监管。”......
  • 5人5月用容器技术保卫蓝天
    摘要:让我们走进四川国蓝中天与华为云的合作案例,一起看看容器技术是如何保卫蓝天的。本文分享自华为云社区《锚定云原生发展!华为云DTSE助力国蓝中天破解容器难题》,作者:华为云赋能云团队四川鲲鹏&欧拉生态创新中心。“一旦发现区域内的污染源,就会精准锁定、自动派单、闭环监管......
  • 3.docker容器相关命令
    docker容器相关命令容器是根据镜像创建的dockerimages1.查看容器dockerpsdockerps-a#查看所有容器2.创建容器dockerrun-itd--nameXXX nginx/bin/bashdockerrun-it-namexxxxxcentos:7参数:-i:一直运行着     -t: 给容器分配一个终端,  ......
  • 容器编排器们的自我介绍
    哈喽大家好,我是咸鱼咸鱼在《一文带你了解容器技术的前世今生》有介绍过容器技术的由来以及Docker项目的发展我们知道,Docker及其他容器技术能够极大地简化应用程序的部署,做到了”开箱即用“俗话说:”凡是具有两面性“。容器技术给我们带来便利的同时,一些问题也随之出现了随着企......
  • docker批量删除容器或镜像
    删除容器停止所有容器删除所有容器,需要先停止所有运行中的容器dockerstop`dockerps-a-q`dockerps-a-q,意思是列出所有容器(包括未运行的),只显示容器编号,其中-a:显示所有的容器,包括未运行的。-q:静默模式,只显示容器编号。1.删除所有处于停止状态的容器使用以......
  • Docker容器使用和操作
    1、容器概念1.1、什么是容器容器(Container):在docker中指的是从镜像创建的应用程序运行实例。可以将容器看作将一个 应用程序及其依赖环境打包 而成的集装箱。容器的实质是进程,与直接在主机执行不同,容器进程在属于自己的独立的命名空间内运行。这种特性使得容器封装的应用程序比直......
  • docker 容器container 镜像image 删除常用备忘
    首先是注意:上面jeecgboot和datahub的容器和镜像都在一起,删除容器的和镜像要注意。要重新部署的话首先要先停掉在跑的容器。通过dockerps查看 红框部分是jeecgboot的前后端容器,其他的是datahub的容器。 2.Jeecgboot是通过jar包部署在cl-mdm容器中。3.部署的过程如下:......
  • Ansible常用模块
    Command模块作用:使用ansible自带模块执行一些简单的命令不能使用><|&''等特殊字符,如果需要使用,则用shell模块。常用参数有:chdir:先切换工作目录,再执行后面的命令,一般情况下在编译时候使用;creates:先切换工作目录,再执行后面的命令,一般情况下在编译时候使用;removes:先切......
  • Docker 镜像原理(commit、容器数据卷)
    dokcer镜像原理联合文件系统(UnionFS)理解:假设:docker中包含的tomcat和mysql均需要使用linux内核,这里使用的linux内核是共用的。下载时候看到的一层层就是这个,Docker镜像实际是由一层一层的文件系统组成联合文件系统时Docker镜像的基础,镜像通过分层来进行继承特性:......
  • windows下搭建docker容器环境
    下载DockerDesktophttps://www.docker.com/安装DockerDesktop(软件默认安装c盘,若要安装到其他盘,在安装之前创建软连接再进行安装)在自定义磁盘中创建对应文件夹,使用mklink/j“原文件夹路径”“目标文件夹路径”进行软连接的创建mklink/j“C:\ProgramFiles\Doc......